From ec3a5e6b3b28184ea7075c6de9d3e95ae37a7c4c Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Fri, 7 Dec 2012 15:06:15 -0500 Subject: keep track of shell and VXI connections separately --- globals.h | 3 ++- gpib.c | 2 +- gpib.h | 2 +- instr-daemon.c | 10 +++++----- menus.c | 8 ++++---- 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/globals.h b/globals.h index 2fa3f17..856f4fa 100644 --- a/globals.h +++ b/globals.h @@ -769,7 +769,8 @@ typedef struct { typedef struct { - int connections; + int terminal_connections; + int vxi_connections; int mode; } RemoteStruct; diff --git a/gpib.c b/gpib.c index 6210b79..6471373 100644 --- a/gpib.c +++ b/gpib.c @@ -777,7 +777,7 @@ static void TNT_Holdoff_off() } -void GPIB_start_query_response(gpointer *ignore_this, char *in_string) +void GPIB_and_VXI_start_query_response(gpointer *ignore_this, char *in_string) { g_assert (ignore_this == NULL); g_assert (in_string != NULL); diff --git a/gpib.h b/gpib.h index 610d74e..65b263b 100644 --- a/gpib.h +++ b/gpib.h @@ -12,7 +12,7 @@ int GPIB_check_for_device_clear_signal(void); int GPIB_check_for_device_clear_signal(void); int GPIB_check_for_messages(char *gpib_buf); int GPIB_handle_new_input(char *gpib_buf); -void GPIB_start_query_response(gpointer *ignore_this, char *in_string); +void GPIB_and_VXI_start_query_response(gpointer *ignore_this, char *in_string); void GPIB_finish_query_response(); void GPIB_check_remote_status (int *is_remote, int *is_lockout); void GPIB_go_to_local (); diff --git a/instr-daemon.c b/instr-daemon.c index 4924961..727b19d 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -102,11 +102,11 @@ incomingConnection (GSocketService *service, GSocketListener *listener, gpointer user_data) { - if(globals.Remote.connections +1 > maxConn) { + if(globals.Remote.terminal_connections +1 > maxConn) { g_print_debug("Connection closed. Max reached\n"); return TRUE; } - globals.Remote.connections++; + globals.Remote.terminal_connections++; g_print_debug("Incoming connection\n"); return FALSE; } @@ -127,7 +127,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 %d connections\n", globals.Remote.connections); + g_print_debug("Handling %d connections\n", globals.Remote.terminal_connections); //register ourselves in the peers vector, use the index obtained in the stdinQueue //should not get -1 @@ -183,7 +183,7 @@ handler (GThreadedSocketService *service, } g_print_debug("Thread end\n"); - globals.Remote.connections--; //keep track of connections + globals.Remote.terminal_connections--; //keep track of connections g_async_queue_unref(queue); //unreference the queue pullIndex(g_thread_self()); //unregister from the peers vector return TRUE; @@ -416,7 +416,7 @@ static gboolean periodic_poll (void) if (GPIB_check_for_messages(globals.Registers.gpib_input_buffer)) { if (GPIB_handle_new_input(globals.Registers.gpib_input_buffer)) { - Parser_main(globals.Registers.gpib_input_buffer, 0, GPIB_start_query_response, NULL); + Parser_main(globals.Registers.gpib_input_buffer, 0, GPIB_and_VXI_start_query_response, NULL); } } diff --git a/menus.c b/menus.c index 812695c..b035b9a 100644 --- a/menus.c +++ b/menus.c @@ -233,7 +233,7 @@ static void update_remote_mode () if (gpib_remote) { globals.Remote.mode += RM_REM; } - if (globals.Remote.connections > 0) { + if (globals.Remote.terminal_connections > 0) { globals.Remote.mode += RM_TERM; } @@ -912,13 +912,13 @@ void Show_Main_Menu(void) break; case (RM_TERM | RM_NOT_REM | RM_NOT_LOCK): case (RM_TERM | RM_NOT_REM | RM_LOCK): - ctrl_str = g_strdup_printf ("LOCAL+%dTER", globals.Remote.connections); + ctrl_str = g_strdup_printf ("LOCAL+%dTER", globals.Remote.terminal_connections); break; case (RM_TERM | RM_REM | RM_NOT_LOCK): - ctrl_str = g_strdup_printf ("LO+GPIB+%dTER", globals.Remote.connections); + ctrl_str = g_strdup_printf ("LO+GPIB+%dTER", globals.Remote.terminal_connections); break; case (RM_TERM | RM_REM | RM_LOCK): - ctrl_str = g_strdup_printf ("GPIB+%dTER", globals.Remote.connections); + ctrl_str = g_strdup_printf ("GPIB+%dTER", globals.Remote.terminal_connections); break; default: ctrl_str = g_strdup ("LOCAL"); -- cgit