Skip to content

Commit c1213a5

Browse files
committed
Make raftable worker socket non-blocking to prevent freezes during accept().
1 parent 69d10b1 commit c1213a5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

contrib/raftable/worker.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ static int create_listening_socket(const char *host, int port)
106106
optval = 1;
107107
setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (char const*)&optval, sizeof(optval));
108108
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (char const*)&optval, sizeof(optval));
109-
109+
fcntl(s, F_SETFL, O_NONBLOCK);
110+
110111
elog(DEBUG1, "binding tcp %s:%d\n", host, port);
111112
if (bind(s, a->ai_addr, a->ai_addrlen) < 0)
112113
{

0 commit comments

Comments
 (0)