Enable load balancing of UNIX sockets across threads
Former-commit-id: 46d6caa47c57fa13055615dfc2376b0962468b81
This commit is contained in:
parent
88b5a4e25f
commit
c64b6127ea
@ -1175,7 +1175,17 @@ void acceptUnixHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
|
|||||||
serverLog(LL_VERBOSE,"Accepted connection to %s", g_pserver->unixsocket);
|
serverLog(LL_VERBOSE,"Accepted connection to %s", g_pserver->unixsocket);
|
||||||
|
|
||||||
aeAcquireLock();
|
aeAcquireLock();
|
||||||
acceptCommonHandler(cfd,CLIENT_UNIX_SOCKET,NULL, ielCur);
|
int ielTarget = rand() % cserver.cthreads;
|
||||||
|
if (ielTarget == ielCur)
|
||||||
|
{
|
||||||
|
acceptCommonHandler(cfd,CLIENT_UNIX_SOCKET,NULL, ielCur);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aePostFunction(g_pserver->rgthreadvar[ielTarget].el, [cfd, ielTarget]{
|
||||||
|
acceptCommonHandler(cfd,CLIENT_UNIX_SOCKET,NULL, ielTarget);
|
||||||
|
});
|
||||||
|
}
|
||||||
aeReleaseLock();
|
aeReleaseLock();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user