From f039fcbb217f0c10dfb668cd07e7e77dbbcf0096 Mon Sep 17 00:00:00 2001 From: "haken.kim" Date: Thu, 24 Sep 2015 18:19:33 +0900 Subject: [PATCH] ecs: error handling when try to connect eventcast Change-Id: I7df2af3ee61cd58d5aa840cfead21578d14d6d5d Signed-off-by: haken.kim --- tizen/src/eventcast/common.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tizen/src/eventcast/common.c b/tizen/src/eventcast/common.c index 0217247..8fde29e 100644 --- a/tizen/src/eventcast/common.c +++ b/tizen/src/eventcast/common.c @@ -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) { -- 2.7.4