From 36fa03dc7b96994a86db9fa7a51e8dd654c27b14 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Thu, 19 Jul 2012 15:50:56 -0400 Subject: change echo to a single multiline string --- response.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'response.c') diff --git a/response.c b/response.c index 6c93622..2321937 100644 --- a/response.c +++ b/response.c @@ -107,15 +107,18 @@ void echoCb(gpointer instance, GObject *arg1, gpointer user_data) 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"); - } + + gchar *out_string = g_strdup_printf("%s\n%s\n%s\n",upper,upper,upper); + gssize out_len = strlen (out_string); + + //send response back to client + written = data->cb(stream, out_string, out_len); + if(written == -1) { + g_print_debug("Could not send message to client\n"); } + g_free(upper); + g_free(out_string); + g_static_mutex_unlock (&mutex); } -- cgit