diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-09-15 15:00:06 +0200 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-09-15 15:00:06 +0200 |
commit | 106e60cc6ad9f14308f32b1a12a3d48364fad638 (patch) | |
tree | 0ac58aa2ddf9bbdc599c9cfba8b9c916563bc891 /src/coordinator.c | |
parent | bd1f6589ccdb1e1568a24417bec72e7300239efe (diff) | |
download | biruda-106e60cc6ad9f14308f32b1a12a3d48364fad638.tar.gz biruda-106e60cc6ad9f14308f32b1a12a3d48364fad638.tar.bz2 |
returning node data from coordinator
Diffstat (limited to 'src/coordinator.c')
-rw-r--r-- | src/coordinator.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/coordinator.c b/src/coordinator.c index 8cd2914..9946e65 100644 --- a/src/coordinator.c +++ b/src/coordinator.c @@ -9,6 +9,7 @@ #include <stdio.h> #include <string.h> +#include <unistd.h> #include "sleep.h" @@ -46,6 +47,10 @@ static void *coordinator_func( void *thread_data ) json_object_object_add( obj, "op", op ); json_object *role = json_object_new_string( "coordinator" ); json_object_object_add( obj, "role", role ); + char hostname[100]; + gethostname( hostname, 100 ); + json_object *host = json_object_new_string( hostname ); + json_object_object_add( obj, "host", host ); const char *msg = json_object_to_json_string( obj ); int msg_size = strlen( msg ) + 1; printf( "coordinator send: %s\n", msg ); |