Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9d040fe

Browse files
committed
windows compatibility ultimate pack
1 parent b9007b1 commit 9d040fe

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
EXTENSION = multimaster
33
DATA = multimaster--1.0.sql
4-
OBJS = multimaster.o arbiter.o bytebuf.o bgwpool.o pglogical_output.o pglogical_proto.o pglogical_receiver.o pglogical_apply.o pglogical_hooks.o pglogical_config.o pglogical_relid_map.o ddd.o bkb.o spill.o referee.o state.o
4+
OBJS = multimaster.o arbiter.o bytebuf.o bgwpool.o pglogical_output.o pglogical_proto.o pglogical_receiver.o pglogical_apply.o pglogical_hooks.o pglogical_config.o pglogical_relid_map.o ddd.o bkb.o spill.o state.o
55
MODULE_big = multimaster
66

77
PG_CPPFLAGS = -I$(libpq_srcdir)

arbiter.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
*
66
*/
77

8+
9+
#ifdef WIN32
10+
#include <winsock2.h>
11+
#include <ws2tcpip.h>
12+
#endif
13+
814
#include <unistd.h>
915
#include <sys/time.h>
1016
#include <sys/types.h>
1117
#include <sys/socket.h>
1218
#include <netinet/in.h>
19+
#ifdef HAVE_NETINET_TCP_H
1320
#include <netinet/tcp.h>
21+
#endif
1422
#include <arpa/inet.h>
1523
#include <errno.h>
1624
#include <netdb.h>
@@ -70,7 +78,7 @@
7078

7179
#if USE_EPOLL
7280
#include <sys/epoll.h>
73-
#else
81+
#elif HAVE_SYS_SELECT_H
7482
#include <sys/select.h>
7583
#endif
7684

@@ -461,8 +469,7 @@ static int MtmConnectSocket(int node, int port)
461469
MTM_ELOG(LOG, "Arbiter failed to create socket: %s", strerror(errno));
462470
goto Error;
463471
}
464-
rc = pg_fcntl(sd, F_SETFL, O_NONBLOCK, MtmUseRDMA);
465-
if (rc < 0) {
472+
if (pg_set_noblock(sd, MtmUseRDMA)) {
466473
MTM_ELOG(LOG, "Arbiter failed to switch socket to non-blocking mode: %s", strerror(errno));
467474
goto Error;
468475
}
@@ -630,8 +637,8 @@ static void MtmAcceptOneConnection()
630637
} else {
631638
MtmHandshakeMessage req;
632639
MtmArbiterMessage resp;
633-
int rc = pg_fcntl(fd, F_SETFL, O_NONBLOCK, MtmUseRDMA);
634-
if (rc < 0) {
640+
int rc;
641+
if (pg_set_noblock(fd,MtmUseRDMA)) {
635642
MTM_ELOG(ERROR, "Arbiter failed to switch socket to non-blocking mode: %s", strerror(errno));
636643
}
637644
rc = MtmReadSocket(fd, &req, sizeof req);

pglogical_receiver.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "replication/origin.h"
3939
#include "utils/portal.h"
4040
#include "tcop/pquery.h"
41-
#include "libpq-int.h"
4241

4342
#include "multimaster.h"
4443
#include "spill.h"

0 commit comments

Comments
 (0)