diff options
author | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-07-19 15:42:23 -0400 |
---|---|---|
committer | Michael J. Chudobiak <mjc@avtechpulse.com> | 2012-07-19 15:42:23 -0400 |
commit | 0fbcb784478e0be2fd7f31f79db45571fdbaef78 (patch) | |
tree | 7ea132fe5d2f1179622391686ad828789bfc34e7 /response.c | |
parent | 31bca4f44d92b6ca0e67f355f46791270a9c471d (diff) | |
parent | 9a5b7483dc16651bbef5aeae9791c9ccb120380a (diff) |
Merge branch 'master' of ulmo:Instrument
Diffstat (limited to 'response.c')
-rw-r--r-- | response.c | 41 |
1 files changed, 21 insertions, 20 deletions
@@ -95,26 +95,27 @@ void initSignals(guint *signal) g_signal_connect (signalObject, "runEchoService", G_CALLBACK (echoCb), NULL); } -//echo 3 times and send to client one time +//send to client 3 times void echoCb(gpointer instance, GObject *arg1, gpointer user_data) { - static GStaticMutex mutex = G_STATIC_MUTEX_INIT; - g_static_mutex_lock (&mutex); - SignalObjectClass *data = (SignalObjectClass*)arg1; - GPollableOutputStream* stream = (GPollableOutputStream*)data->outStream; - gchar* str = data->data; - gssize len = data->size; - gssize written = 0; - - gchar* upper = g_ascii_strup(str, len); - int i; - for(i=0; i<3; i++) { - g_print("%s\n", upper); - } - //send response back to client - - written = data->cb(stream, upper, len); - - g_free(upper); - g_static_mutex_unlock (&mutex); + static GStaticMutex mutex = G_STATIC_MUTEX_INIT; + g_static_mutex_lock (&mutex); + SignalObjectClass *data = (SignalObjectClass*)arg1; + GPollableOutputStream* stream = (GPollableOutputStream*)data->outStream; + gchar* str = data->data; + gssize len = data->size; + gssize written = 0; + + gchar* upper = g_ascii_strup(str, len); + int i; + + for(i=0; i<3; i++) { + //send response back to client + written = data->cb(stream, upper, len); + if(written == -1) { + g_print_debug("Could not send message to client\n"); + } + } + g_free(upper); + g_static_mutex_unlock (&mutex); } |