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

Commit0e92f98

Browse files
committed
On win32, don't use SO_REUSEADDR for TCP sockets.
Per failure on buildfarm member baiji and subsequent discussion.
1 parent9539e64 commit0e92f98

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

‎src/backend/libpq/pqcomm.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
3131
* Portions Copyright (c) 1994, Regents of the University of California
3232
*
33-
*$PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.191 2007/03/03 19:32:54 neilc Exp $
33+
*$PostgreSQL: pgsql/src/backend/libpq/pqcomm.c,v 1.192 2007/06/04 11:59:20 mha Exp $
3434
*
3535
*-------------------------------------------------------------------------
3636
*/
@@ -337,6 +337,16 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
337337
continue;
338338
}
339339

340+
#ifndefWIN32
341+
/*
342+
* Without the SO_REUSEADDR flag, a new postmaster can't be started right away after
343+
* a stop or crash, giving "address already in use" error on TCP ports.
344+
*
345+
* On win32, however, this behavior only happens if the SO_EXLUSIVEADDRUSE is set.
346+
* With SO_REUSEADDR, win32 allows multiple servers to listen on the same address,
347+
* resulting in unpredictable behavior. With no flags at all, win32 behaves as
348+
* Unix with SO_REUSEADDR.
349+
*/
340350
if (!IS_AF_UNIX(addr->ai_family))
341351
{
342352
if ((setsockopt(fd,SOL_SOCKET,SO_REUSEADDR,
@@ -349,6 +359,7 @@ StreamServerPort(int family, char *hostName, unsigned short portNumber,
349359
continue;
350360
}
351361
}
362+
#endif
352363

353364
#ifdefIPV6_V6ONLY
354365
if (addr->ai_family==AF_INET6)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp