summaryrefslogtreecommitdiff
path: root/src/lib/evas/cserve2/evas_cs2_client.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-06-18 20:50:17 +0900
committerCedric Bail <cedric.bail@samsung.com>2013-06-20 17:42:07 +0900
commit1821c91d1076e5350fce7ed92d2ea670518338e1 (patch)
treedb225fcc0ca0f332372388cab43642a700ba0fb9 /src/lib/evas/cserve2/evas_cs2_client.c
parent6adb604dae4ee7cc99fe94399df6818f2ba9481d (diff)
cserve2: prevent infinite loop during connection
In case of EACCESS, there is no point trying forever In case of EINTR (interrupt), we can consider for now that any signal will prevent the use of cserve2. If we don't do that, Ctrl+C simply won't work :)
Diffstat (limited to '')
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index 646cd83229..22129552ef 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -107,10 +107,22 @@ _server_connect(void)
107 len = strlen(remote.sun_path) + sizeof(remote.sun_family); 107 len = strlen(remote.sun_path) + sizeof(remote.sun_family);
108 for (;;) 108 for (;;)
109 { 109 {
110 errno = 0;
110 if (connect(s, (struct sockaddr *)&remote, len) != -1) break; 111 if (connect(s, (struct sockaddr *)&remote, len) != -1) break;
112 if (errno == EACCES)
113 {
114 ERR("not authorized to connect to cserve2!");
115 return EINA_FALSE;
116 }
111 ERR("cserve2 connect failed: [%d] %s. Retrying...", errno, strerror(errno)); 117 ERR("cserve2 connect failed: [%d] %s. Retrying...", errno, strerror(errno));
112 118
113 usleep(1000); 119 errno = 0;
120 usleep(10000);
121 if (errno == EINTR)
122 {
123 WRN("received interruption while trying to connect to cserve2!");
124 return EINA_FALSE;
125 }
114 126
115 /* FIXME: Here we should identify the error, maybe signal the daemon manager 127 /* FIXME: Here we should identify the error, maybe signal the daemon manager
116 * that we need cserve2 to [re]start or just quit and return false. 128 * that we need cserve2 to [re]start or just quit and return false.