diff options
author | Sander Vrijders <[email protected]> | 2016-05-08 16:34:19 +0200 |
---|---|---|
committer | Sander Vrijders <[email protected]> | 2016-05-08 16:34:19 +0200 |
commit | 5812dfb832e513dc455a0d48624bcad62334d457 (patch) | |
tree | 93a02e1b20f54bb869eadc856f201412c633315c /src/tools/echo/echo_client.c | |
parent | de8f2015cbd015b1cced366cb12c054be62c23b1 (diff) | |
parent | 021af9e01ce6c6376534b33ef1a06ea4189028d4 (diff) | |
download | ouroboros-5812dfb832e513dc455a0d48624bcad62334d457.tar.gz ouroboros-5812dfb832e513dc455a0d48624bcad62334d457.zip |
Merged in dstaesse/ouroboros/be-fast-path (pull request #65)
irmd: flow allocation and fast path
Diffstat (limited to 'src/tools/echo/echo_client.c')
-rw-r--r-- | src/tools/echo/echo_client.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/tools/echo/echo_client.c b/src/tools/echo/echo_client.c index 8d3fc322..9cf56cee 100644 --- a/src/tools/echo/echo_client.c +++ b/src/tools/echo/echo_client.c @@ -23,19 +23,25 @@ #define CLIENT_AP_NAME "echo-client" #include <ouroboros/dev.h> +#include <stdlib.h> int client_main() { int fd = 0; int result = 0; - uint8_t buf[BUF_SIZE]; + char buf[BUF_SIZE]; char * message = "Client says hi!"; ssize_t count = 0; - fd = flow_alloc(SERVER_AP_NAME, CLIENT_AP_NAME, - NULL, NULL, 0); + if(ap_init(CLIENT_AP_NAME)) { + printf("Failed to init AP."); + return -1; + } + + fd = flow_alloc(SERVER_AP_NAME, NULL, NULL); if (fd < 0) { printf("Failed to allocate flow\n"); + ap_fini(); return -1; } @@ -43,12 +49,14 @@ int client_main() if (result < 0) { printf("Flow allocation refused\n"); flow_dealloc(fd); + ap_fini(); return -1; } if (flow_write(fd, message, strlen(message) + 1) == -1) { printf("Failed to write SDU\n"); flow_dealloc(fd); + ap_fini(); return -1; } @@ -56,6 +64,7 @@ int client_main() if (count < 0) { printf("Failed to read SDU\n"); flow_dealloc(fd); + ap_fini(); return -1; } @@ -63,5 +72,7 @@ int client_main() flow_dealloc(fd); + ap_fini(); + return 0; } |