summaryrefslogtreecommitdiff
path: root/response.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2012-07-19 14:48:02 -0400
committerMichael J. Chudobiak <mjc@avtechpulse.com>2012-07-19 14:48:02 -0400
commit9a5b7483dc16651bbef5aeae9791c9ccb120380a (patch)
tree1bbe0cd66dd30b9118e5c504f11829e0b2f487c0 /response.c
parent4e6a4994026bffa5036af51124099de4ebab413d (diff)
added make install; fixed echoing
Diffstat (limited to 'response.c')
-rw-r--r--response.c41
1 files changed, 21 insertions, 20 deletions
diff --git a/response.c b/response.c
index 4a16cf3..6c93622 100644
--- a/response.c
+++ b/response.c
@@ -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);
}