Changed windows title when connecting to socket.

Fixed some issue with operations interlocking.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4944 818b1a75-f10b-46b9-bf7c-635c3b92a50f
This commit is contained in:
winckel
2014-01-24 22:41:39 +00:00
parent 49b4149b38
commit 46ae17e771
4 changed files with 61 additions and 63 deletions
+17 -13
View File
@@ -319,25 +319,29 @@ 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));
if ((ret < 0) && ((socket_abort_connection) || (retry < 0))) {
if (retry < 0) {
g_warning("Failed to connect to peer %s:%d",
socket_data->ip_address, socket_data->port);
ui_pipe_write_message(socket_data->pipe_fd,
UI_PIPE_CONNECTION_FAILED, NULL, 0);
ret = connect(socket_data->sd, (struct sockaddr *) &si_me, sizeof(struct sockaddr_in));
if (ret < 0) {
if ((socket_abort_connection) || (retry < 0)) {
if (retry < 0) {
g_warning("Failed to connect to peer %s:%d", socket_data->ip_address, socket_data->port);
ui_pipe_write_message(socket_data->pipe_fd, UI_PIPE_CONNECTION_FAILED, NULL, 0);
}
free(socket_data->ip_address);
free(socket_data);
/* Quit the thread */
pthread_exit(NULL);
}
free(socket_data->ip_address);
free(socket_data);
/* Quit the thread */
pthread_exit(NULL);
usleep(SOCKET_US_BEFORE_CONNECT_RETRY);
retry--;
}
usleep(SOCKET_US_BEFORE_CONNECT_RETRY);
retry --;
} 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);