Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2355da8

Browse files
committed
more portable way to switch socket to nonblock mode
1 parent9527db9 commit2355da8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎arbiter.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include<errno.h>
1717
#include<netdb.h>
1818
#include<time.h>
19+
#include<fcntl.h>
1920

2021
#include"postgres.h"
2122
#include"fmgr.h"
@@ -380,10 +381,11 @@ static int MtmConnectSocket(char const* host, int port, int max_attempts)
380381
while (1) {
381382
intrc=-1;
382383

383-
sd=socket(AF_INET,SOCK_STREAM|SOCK_NONBLOCK,0);
384+
sd=socket(AF_INET,SOCK_STREAM,0);
384385
if (sd<0) {
385386
elog(ERROR,"Arbiter failed to create socket: %d",errno);
386387
}
388+
fcntl(sd,F_SETFL,O_NONBLOCK);
387389
busy_socket=sd;
388390
for (i=0;i<n_addrs;++i) {
389391
memcpy(&sock_inet.sin_addr,&addrs[i],sizeofsock_inet.sin_addr);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp