mutex unlock during sockt_send 97/47097/2
authorGukhwan Cho <gh78.cho@samsung.com>
Thu, 20 Aug 2015 12:20:51 +0000 (21:20 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Tue, 1 Sep 2015 09:21:02 +0000 (18:21 +0900)
Change-Id: I3d6426304d92769dadb35e9f7d11d4bd6e45456a
Signed-off-by: Gukhwan Cho <gh78.cho@samsung.com>
src/pims-ipc-svc.c
src/pims-socket.c

index 8c04ed3..9c74fd5 100644 (file)
@@ -424,6 +424,7 @@ API int pims_ipc_svc_publish(char *module, char *event, pims_ipc_data_h data)
                int ret = 0;
                while(cursor) {
                        int fd = (int)cursor->data;
+                       pthread_mutex_unlock(&ipc_svc->subscribe_fds_mutex);
                        ret = socket_send(fd, buf, length);
                        if (ret < 0) {
                                ERROR("socket_send publish error : %d", ret);
@@ -435,6 +436,7 @@ API int pims_ipc_svc_publish(char *module, char *event, pims_ipc_data_h data)
                                        ERROR("socket_send_data publish error : %d", ret);
                                }
                        }
+                       pthread_mutex_lock(&ipc_svc->subscribe_fds_mutex);
                        cursor = g_list_next(cursor);
                }
                pthread_mutex_unlock(&ipc_svc->subscribe_fds_mutex);
index 2870a81..6530945 100644 (file)
@@ -44,12 +44,18 @@ int socket_send(int fd, char *buf, int len)
        while (length > 0) {
                passed_len = send(fd, (const void *)buf, length, MSG_NOSIGNAL);
                if (passed_len == -1) {
-                       if (errno == EINTR)
+                       if (errno == EINTR){
+                               ERROR("EINTR error. send retry");
                                continue;
-                       else if (errno == EAGAIN)
+                       }
+                       else if (errno == EAGAIN) {
+                               ERROR("EAGAIN error. send retry");
                                continue;
-                       else if (errno == EWOULDBLOCK)
+                       }
+                       else if (errno == EWOULDBLOCK) {
+                               ERROR("EWOULDBLOCK error. send retry");
                                continue;
+                       }
                        ERROR("send error [%d]", errno);
                        break;
                } else if (passed_len == 0)