summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--control_service.c24
1 files changed, 13 insertions, 11 deletions
diff --git a/control_service.c b/control_service.c
index 9a63dfd..1dca7a9 100644
--- a/control_service.c
+++ b/control_service.c
@@ -17,19 +17,21 @@ static gboolean service_incoming(GSocketService *service,
GSocket *socket = g_socket_connection_get_socket(connection);
gchar buffer[0x400];
- gssize size = g_socket_receive(socket, buffer, 0x400, NULL, NULL);
+ gssize size;
- gchar *pos = g_strstr_len(buffer, size, "\r");
- if(pos == NULL) {
- pos = g_strstr_len(buffer, size, "\n");
- }
- if(pos == NULL) {
- g_warning("EOL not found");
- return FALSE;
- }
- *pos = '\0';
+ while((size = g_socket_receive(socket, buffer, 0x400, NULL, NULL)) > 0) {
+ gchar *pos = g_strstr_len(buffer, size, "\r");
+ if(pos == NULL) {
+ pos = g_strstr_len(buffer, size, "\n");
+ }
+ if(pos == NULL) {
+ g_warning("EOL not found");
+ return FALSE;
+ }
+ *pos = '\0';
- control_commands_handle(connection, buffer);
+ control_commands_handle(connection, buffer);
+ }
return FALSE;
}