summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2017-04-10 21:36:26 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2017-04-10 21:36:26 +0200
commit80900470d00c56d2fa51fb7c3da429d09e1d9a78 (patch)
treed1ebefbc224fb6d24776d227cef69c93451adeba
parent8342fcc144bd8f1d9a24c1a018c15440dd43481d (diff)
Enforce flush of incoming data
Change-Id: I81deb974460e7f3edbccf132efeac87f873d78dd Signed-off-by: José Bollo <jose.bollo@iot.bzh>
-rw-r--r--src/afb-client-demo.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/afb-client-demo.c b/src/afb-client-demo.c
index 434c6d17..4cbc9c7a 100644
--- a/src/afb-client-demo.c
+++ b/src/afb-client-demo.c
@@ -111,6 +111,7 @@ int main(int ac, char **av, char **env)
static void on_hangup(void *closure, struct afb_wsj1 *wsj1)
{
printf("ON-HANGUP\n");
+ fflush(stdout);
exit(0);
}
@@ -119,6 +120,7 @@ static void on_call(void *closure, const char *api, const char *verb, struct afb
{
int rc;
printf("ON-CALL %s/%s(%s)\n", api, verb, afb_wsj1_msg_object_s(msg));
+ fflush(stdout);
rc = afb_wsj1_reply_error_s(msg, "\"unimplemented\"", NULL);
if (rc < 0)
fprintf(stderr, "replying failed: %m\n");
@@ -128,12 +130,14 @@ static void on_call(void *closure, const char *api, const char *verb, struct afb
static void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg)
{
printf("ON-EVENT %s(%s)\n", event, afb_wsj1_msg_object_s(msg));
+ fflush(stdout);
}
/* called when wsj1 receives a reply */
static void on_reply(void *closure, struct afb_wsj1_msg *msg)
{
printf("ON-REPLY %s: %s\n", (char*)closure, afb_wsj1_msg_object_s(msg));
+ fflush(stdout);
free(closure);
callcount--;
if (exonrep && !callcount)