// loglen = sprintf(logstr, "%d|%s\n", log->type, log->data);
pthread_mutex_lock(&(manager.host.data_socket_mutex));
- send(manager.host.data_socket, logstr, loglen, MSG_NOSIGNAL);
+ if(0 > send(manager.host.data_socket, logstr, loglen, MSG_NOSIGNAL))
+ {
+ LOGE("fail to send data to host(%d)\n", log->type);
+ }
pthread_mutex_unlock(&(manager.host.data_socket_mutex));
return 0;
}
else
loglen = sprintf(logstr, "%d|0|", (int)resp);
- send(manager.host.control_socket, logstr, loglen, MSG_NOSIGNAL);
+ if(0 > send(manager.host.control_socket, logstr, loglen, MSG_NOSIGNAL))
+ {
+ LOGE("fail to send ACK string to host(%s)\n", logstr);
+ }
return 0;
}
else
codelen = sprintf(codestr, "%d", msgcode);
loglen = sprintf(logstr, "%d|%d|%s", (int)resp, codelen, codestr);
- send(manager.host.control_socket, logstr, loglen, MSG_NOSIGNAL);
+ if(0 > send(manager.host.control_socket, logstr, loglen, MSG_NOSIGNAL))
+ {
+ LOGE("fail to send ACK code to host(%s)\n", logstr);
+ }
return 0;
}
else
{
if(manager.target[i].socket != -1)
{
- send(manager.target[i].socket, &sendlog, sizeof(sendlog.type) + sizeof(sendlog.length) + sendlog.length, MSG_NOSIGNAL);
+ if(0 > send(manager.target[i].socket, &sendlog, sizeof(sendlog.type) + sizeof(sendlog.length) + sendlog.length, MSG_NOSIGNAL))
+ {
+ LOGE("fail to send option to target(sock:%d)\n", manager.target[i].socket);
+ }
}
}
}
manager.target[index].socket, manager.target[index].pid, manager.target_count - 1);
terminate_target(index);
- epoll_ctl(epollfd, EPOLL_CTL_DEL, manager.target[index].event_fd, NULL);
+ if(0 > epoll_ctl(epollfd, EPOLL_CTL_DEL, manager.target[index].event_fd, NULL))
+ {
+ LOGW("fail to EPOLL DEL of event fd(%d)\n", index);
+ }
setEmptyTargetSlot(index);
if (0 == __sync_sub_and_fetch(&manager.target_count, 1)) // all target client are closed
{
// send config message to target process
log.type = MSG_OPTION;
log.length = sprintf(log.data, "%u", manager.config_flag);
- send(manager.target[index].socket, &log, sizeof(log.type) + sizeof(log.length) + log.length, MSG_NOSIGNAL);
+ if(0 > send(manager.target[index].socket, &log, sizeof(log.type) + sizeof(log.length) + log.length, MSG_NOSIGNAL))
+ {
+ LOGE("fail to send initial option to target(sock:%d)\n", manager.target[index].socket);
+ }
// make event fd
manager.target[index].event_fd = eventfd(0, EFD_NONBLOCK);
{
// fail to make recv thread
LOGE("fail to make recv thread for socket (%d)\n", manager.target[index].socket);
- epoll_ctl(efd, EPOLL_CTL_DEL, manager.target[index].event_fd, NULL);
+ if(0 > epoll_ctl(efd, EPOLL_CTL_DEL, manager.target[index].event_fd, NULL))
+ {
+ LOGW("fail to EPOLL DEL of event fd(%d)\n", index);
+ }
goto TARGET_CONNECT_FAIL;
}
if(manager.app_launch_timerfd >= 0)
{
- epoll_ctl(efd, EPOLL_CTL_DEL, manager.app_launch_timerfd, NULL);
+ if(0 > epoll_ctl(efd, EPOLL_CTL_DEL, manager.app_launch_timerfd, NULL))
+ {
+ LOGW("fail to EPOLL DEL of app launch timerfd\n");
+ }
close(manager.app_launch_timerfd);
manager.app_launch_timerfd = -1;
}
recvLen = recv(manager.host.data_socket, recvBuf, 32, MSG_DONTWAIT);
if(recvLen == 0)
{ // close data socket
- epoll_ctl(efd, EPOLL_CTL_DEL, manager.host.data_socket, NULL);
+ if(0 > epoll_ctl(efd, EPOLL_CTL_DEL, manager.host.data_socket, NULL))
+ {
+ LOGW("fail to EPOLL DEL of host data socket\n");
+ }
close(manager.host.data_socket);
manager.host.data_socket = -1;
}
{
// send to host timeout error message for launching application
terminate_error("Failed to launch application", 1);
- epoll_ctl(efd, EPOLL_CTL_DEL, manager.app_launch_timerfd, NULL);
+ if(0 > epoll_ctl(efd, EPOLL_CTL_DEL, manager.app_launch_timerfd, NULL))
+ {
+ LOGW("fail to EPOLL DEL of app launch timerfd\n");
+ }
close(manager.app_launch_timerfd);
manager.app_launch_timerfd = -1;
ret = -1;