ecs: error handling when try to connect eventcast
authorhaken.kim <haken.kim@samsung.com>
Thu, 24 Sep 2015 09:19:33 +0000 (18:19 +0900)
committerhaken.kim <haken.kim@samsung.com>
Thu, 24 Sep 2015 09:19:33 +0000 (18:19 +0900)
Change-Id: I7df2af3ee61cd58d5aa840cfead21578d14d6d5d
Signed-off-by: haken.kim <haken.kim@samsung.com>
tizen/src/eventcast/common.c

index 0217247..8fde29e 100644 (file)
@@ -581,7 +581,7 @@ static int start_eventcast_socket(const char *ipaddress, int port)
     qemu_set_nonblock(sock);
 
     set_eventcast_connection_status(CONNECTING);
-
+    int conn_err_count = 0;
     while (1) {
         ret = connect(sock, (struct sockaddr *)&addr, sizeof(addr));
 
@@ -619,6 +619,11 @@ static int start_eventcast_socket(const char *ipaddress, int port)
                 continue;
             } else if (connection_errno == EALREADY) {
                 LOG_INFO("a previous connection has not yet been completed\n");
+                if(conn_err_count++ > 50){
+                    LOG_INFO("too much waiting. connect failure\n");
+                    ret = -connection_errno;
+                    break;
+                }
                 ret = 0;
                 continue;
             } else if (connection_errno == EISCONN) {