diff --git a/common/utils/itti_analyzer/libbuffers/socket.c b/common/utils/itti_analyzer/libbuffers/socket.c index 5c62bdc46f3ae6a390057105fc88e639f74318d2..7748965e5eaed5299dc146363b7069cb8d75fe75 100644 --- a/common/utils/itti_analyzer/libbuffers/socket.c +++ b/common/utils/itti_analyzer/libbuffers/socket.c @@ -319,8 +319,6 @@ void *socket_thread_fct(void *arg) tv.tv_sec = 0; tv.tv_usec = 1000 * SOCKET_MS_BEFORE_SIGNALLING; - ui_set_title ("connecting to %s:%d ...", socket_data->ip_address, socket_data->port); - do { /* Connecting to remote peer */ ret = connect(socket_data->sd, (struct sockaddr *) &si_me, sizeof(struct sockaddr_in)); @@ -340,8 +338,6 @@ void *socket_thread_fct(void *arg) } } while (ret < 0); - ui_set_title ("%s:%d", socket_data->ip_address, socket_data->port); - /* Set the socket as non-blocking */ fcntl(socket_data->sd, F_SETFL, O_NONBLOCK); diff --git a/common/utils/itti_analyzer/libui/ui_callbacks.c b/common/utils/itti_analyzer/libui/ui_callbacks.c index d4228f36695ebd75c70e95a86188893470cc04c6..72033c29201d4907f5c18443a8a0a23e4f21c8e5 100644 --- a/common/utils/itti_analyzer/libui/ui_callbacks.c +++ b/common/utils/itti_analyzer/libui/ui_callbacks.c @@ -33,6 +33,9 @@ static gboolean refresh_message_list = TRUE; static gboolean filters_changed = FALSE; static gboolean operation_running = FALSE; +static const char *ui_ip; +static uint16_t ui_port; + gboolean ui_callback_on_open_messages(GtkWidget *widget, gpointer data) { gboolean refresh = (data != NULL) ? TRUE : FALSE; @@ -551,6 +554,7 @@ gboolean ui_pipe_callback(gint source, gpointer user_data) return ui_handle_socket_connection_lost (source); case UI_PIPE_XML_DEFINITION: + ui_set_title ("%s:%d", ui_ip, ui_port); return ui_handle_socket_xml_definition (source, input_data, input_data_length); case UI_PIPE_UPDATE_SIGNAL_LIST: @@ -565,25 +569,23 @@ gboolean ui_pipe_callback(gint source, gpointer user_data) gboolean ui_callback_on_connect(GtkWidget *widget, gpointer data) { - /* We have to retrieve the ip address and port of remote host */ - const char *ip; - uint16_t port; + /* We have to retrieve the ip address and ui_port of remote host */ int pipe_fd[2]; - port = atoi (gtk_entry_get_text (GTK_ENTRY(ui_main_data.port_entry))); - ip = gtk_entry_get_text (GTK_ENTRY(ui_main_data.ip_entry)); + ui_port = atoi (gtk_entry_get_text (GTK_ENTRY(ui_main_data.port_entry))); + ui_ip = gtk_entry_get_text (GTK_ENTRY(ui_main_data.ip_entry)); - g_message("Connect event occurred to %s:%d", ip, port); + g_message("Connect event occurred to %s:%d", ui_ip, ui_port); - if (strlen (ip) == 0) + if (strlen (ui_ip) == 0) { ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "Connect", "Empty host ip address"); return FALSE; } - if (port == 0) + if (ui_port == 0) { - ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "Connect", "Invalid host port value"); + ui_notification_dialog (GTK_MESSAGE_ERROR, FALSE, "Connect", "Invalid host ui_port value"); return FALSE; } @@ -601,7 +603,9 @@ gboolean ui_callback_on_connect(GtkWidget *widget, gpointer data) ui_callback_signal_clear_list (widget, data); - if (socket_connect_to_remote_host (ip, port, pipe_fd[1]) != 0) + ui_set_title ("connecting to %s:%d ...", ui_ip, ui_port); + + if (socket_connect_to_remote_host (ui_ip, ui_port, pipe_fd[1]) != 0) { ui_enable_connect_button (); operation_running = FALSE;