[MINOR] unix sockets : inherits the backlog size from the listener
Since unix sockets are supported for bind, the default backlog size was not enough to accept the traffic. The size is now inherited from the listener to behave like the tcp listeners. This also affects the "stats socket" backlog, which is now determined by "stats maxconn".
This commit is contained in:
parent
48d84c10b5
commit
e4cbbe2a0e
|
@ -79,7 +79,7 @@ static struct protocol proto_unix = {
|
|||
* OS, it's still useful where it works.
|
||||
* It returns the assigned file descriptor, or -1 in the event of an error.
|
||||
*/
|
||||
static int create_uxst_socket(const char *path, uid_t uid, gid_t gid, mode_t mode, char *errmsg, int errlen)
|
||||
static int create_uxst_socket(const char *path, uid_t uid, gid_t gid, mode_t mode, int backlog, char *errmsg, int errlen)
|
||||
{
|
||||
char tempname[MAXPATHLEN];
|
||||
char backname[MAXPATHLEN];
|
||||
|
@ -156,7 +156,7 @@ static int create_uxst_socket(const char *path, uid_t uid, gid_t gid, mode_t mod
|
|||
goto err_unlink_temp;
|
||||
}
|
||||
|
||||
if (listen(sock, 0) < 0) {
|
||||
if (listen(sock, backlog) < 0) {
|
||||
msg = "cannot listen to UNIX socket";
|
||||
goto err_unlink_temp;
|
||||
}
|
||||
|
@ -249,7 +249,9 @@ static int uxst_bind_listener(struct listener *listener, char *errmsg, int errle
|
|||
fd = create_uxst_socket(((struct sockaddr_un *)&listener->addr)->sun_path,
|
||||
listener->perm.ux.uid,
|
||||
listener->perm.ux.gid,
|
||||
listener->perm.ux.mode, errmsg, errlen);
|
||||
listener->perm.ux.mode,
|
||||
listener->backlog ? listener->backlog : listener->maxconn,
|
||||
errmsg, errlen);
|
||||
if (fd == -1) {
|
||||
return ERR_FATAL | ERR_ALERT;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue