summaryrefslogtreecommitdiff
path: root/instr-daemon.c
diff options
context:
space:
mode:
Diffstat (limited to 'instr-daemon.c')
-rw-r--r--instr-daemon.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/instr-daemon.c b/instr-daemon.c
index a60ed83..553745f 100644
--- a/instr-daemon.c
+++ b/instr-daemon.c
@@ -23,8 +23,7 @@ static gboolean periodic_poll (void);
int port=3333; //port to listen
-int connections=0;
-int maxConn=16; //max connections - 16
+int maxConn=8; //max connections - 8
guint signalMyCb; //signal to register which is used in cbClientInput(), step 10 from requirements
GAsyncQueue** stdinQueue=NULL;
@@ -101,11 +100,11 @@ incomingConnection (GSocketService *service,
GSocketListener *listener,
gpointer user_data)
{
- if(connections +1 > maxConn) {
+ if(globals.Remote.connections +1 > maxConn) {
g_print_debug("Connection closed. Max reached\n");
return TRUE;
}
- connections++;
+ globals.Remote.connections++;
g_print_debug("Incoming connection\n");
return FALSE;
}
@@ -126,7 +125,7 @@ handler (GThreadedSocketService *service,
out = g_io_stream_get_output_stream (G_IO_STREAM (connection));
in = g_io_stream_get_input_stream (G_IO_STREAM (connection));
- g_print_debug("Handling, connections: %d\n", connections);
+ g_print_debug("Handling %d connections\n", globals.Remote.connections);
//register ourselves in the peers vector, use the index obtained in the stdinQueue
//should not get -1
@@ -182,7 +181,7 @@ handler (GThreadedSocketService *service,
}
g_print_debug("Thread end\n");
- connections--; //keep track of connections
+ globals.Remote.connections--; //keep track of connections
g_async_queue_unref(queue); //unreference the queue
pullIndex(g_thread_self()); //unregister from the peers vector
return TRUE;