Browse Source

Revert "Do not overlap writes to unix sockets"

This reverts commit 6f77624613.
master
ckolivas 10 years ago
parent
commit
dd3a4a121a
  1. 8
      src/ckpool.c
  2. 1
      src/ckpool.h

8
src/ckpool.c

@ -447,26 +447,21 @@ bool _send_proc(proc_instance_t *pi, const char *msg, const char *file, const ch
LOGALERT("Attempting to send message %s to non existent process %s", msg, pi->processname); LOGALERT("Attempting to send message %s to non existent process %s", msg, pi->processname);
goto out; goto out;
} }
mutex_lock(&pi->lock);
sockd = open_unix_client(path); sockd = open_unix_client(path);
if (unlikely(sockd < 0)) { if (unlikely(sockd < 0)) {
LOGWARNING("Failed to open socket %s", path); LOGWARNING("Failed to open socket %s", path);
goto out_unlock; goto out;
} }
if (unlikely(!send_unix_msg(sockd, msg))) if (unlikely(!send_unix_msg(sockd, msg)))
LOGWARNING("Failed to send %s to socket %s", msg, path); LOGWARNING("Failed to send %s to socket %s", msg, path);
else else
ret = true; ret = true;
Close(sockd); Close(sockd);
out_unlock:
mutex_unlock(&pi->lock);
out: out:
if (unlikely(!ret)) { if (unlikely(!ret)) {
LOGERR("Failure in send_proc from %s %s:%d", file, func, line); LOGERR("Failure in send_proc from %s %s:%d", file, func, line);
childsighandler(15); childsighandler(15);
} }
return ret; return ret;
} }
@ -1023,7 +1018,6 @@ static proc_instance_t *prepare_child(ckpool_t *ckp, int (*process)(), char *nam
pi->processname = name; pi->processname = name;
pi->sockname = pi->processname; pi->sockname = pi->processname;
pi->process = process; pi->process = process;
mutex_init(&pi->lock);
create_process_unixsock(pi); create_process_unixsock(pi);
return pi; return pi;
} }

1
src/ckpool.h

@ -49,7 +49,6 @@ struct proc_instance {
char *sockname; char *sockname;
int pid; int pid;
int (*process)(proc_instance_t *); int (*process)(proc_instance_t *);
pthread_mutex_t lock;
}; };
struct connsock { struct connsock {

Loading…
Cancel
Save