diff options
author | Andreas Baumann <mail@andreasbaumann.cc> | 2014-11-16 20:16:01 +0100 |
---|---|---|
committer | Andreas Baumann <mail@andreasbaumann.cc> | 2014-11-16 20:16:01 +0100 |
commit | 36a9558737abb4fc6440903361a6c175a4140f35 (patch) | |
tree | 1d08e3f3ecdf41ebecf017222cb1cbcf2edd09b5 /src/webserver.c | |
parent | 3ecaed99580f378fbcb2598b2570c65d0f3ebc99 (diff) | |
download | biruda-36a9558737abb4fc6440903361a6c175a4140f35.tar.gz biruda-36a9558737abb4fc6440903361a6c175a4140f35.tar.bz2 |
workers are communicated from coordinator to master during registration now
status shows worker states too
Diffstat (limited to 'src/webserver.c')
-rw-r--r-- | src/webserver.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/webserver.c b/src/webserver.c index 908c2a7..a824506 100644 --- a/src/webserver.c +++ b/src/webserver.c @@ -28,16 +28,26 @@ static int handle_request( void *cls, struct MHD_Connection *connection, coordinator_t *c = &coordinator[pos]; if( c->used ) { char part[256]; - snprintf( part, 256, "%s %s %s %d %s %lld (%d) %d\n", + snprintf( part, sizeof( part ), + "coordinator %s %s %s %d %s %lld (%d)\n", c->host, c->os, c->arch, c->cpus, ( c->alive ? "alive" : "dead" ), - (long long)c->lastAlive, pos, - c->nof_workers ); - strncat( biruda_msg, part, 2048 ); + (long long)c->lastAlive, pos ); + strncat( biruda_msg, part, sizeof( biruda_msg ) ); + + for( int i = 0; i < c->nof_workers; i++ ) { + worker_t *w = &c->worker[i]; + snprintf( part, sizeof( part ), + "worker %s %s %s (%d)\n", + w->name, worker_exection_mode_str( w->mode ), + ( w->command == NULL ? "" : w->command ), + i ); + strncat( biruda_msg, part, sizeof( biruda_msg ) ); + } } } } else { - snprintf( biruda_msg, 2048, "Welcome to biruda! Please state your wish..\n" ); + snprintf( biruda_msg, sizeof( biruda_msg ), "Welcome to biruda! Please state your wish..\n" ); } response = MHD_create_response_from_buffer( strlen( biruda_msg ), |