Skip to content

Commit 7640fe7

Browse files
committed
[MSWSOCK]
- Fix IsSockaddrEqualToZero - Comment out the broken async connect code (as it is in our current msafd) - Fix a deadlock bug and socket descriptor leak when disconnecting a datagram socket - Fix bug in the SO_BROADCAST check svn path=/branches/aicom-network-branch/; revision=48524
1 parent c2fc6d4 commit 7640fe7

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

dll/win32/mswsock/msafd/connect.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ IsSockaddrEqualToZero(IN const struct sockaddr* SocketAddress,
2222
for (i = 0; i < SocketAddressLength; i++)
2323
{
2424
/* Make sure it's 0 */
25-
if (*(PULONG)SocketAddress + i)return FALSE;
25+
if (*(PULONG)(SocketAddress + i)) return FALSE;
2626
}
2727

2828
/* All zeroes, succees! */
@@ -171,6 +171,7 @@ SockDoConnectReal(IN PSOCKET_INFORMATION Socket,
171171
/* Set the SAN State */
172172
ConnectInfo->UseSAN = SockSanEnabled;
173173

174+
#if 0
174175
/* Check if this is a non-blocking streaming socket */
175176
if ((Socket->SharedData.NonBlocking) && !(MSAFD_IS_DGRAM_SOCK(Socket)))
176177
{
@@ -185,6 +186,7 @@ SockDoConnectReal(IN PSOCKET_INFORMATION Socket,
185186
Status = 0;
186187
}
187188
else
189+
#endif
188190
{
189191
/* Start the connect loop */
190192
do
@@ -386,8 +388,11 @@ SockDoConnect(SOCKET Handle,
386388
(MSAFD_IS_DGRAM_SOCK(Socket)) &&
387389
(IsSockaddrEqualToZero(SocketAddress, SocketAddressLength)))
388390
{
389-
/* Disconnect the socket and return */
390-
return UnconnectDatagramSocket(Socket);
391+
/* Disconnect the socket */
392+
ErrorCode = UnconnectDatagramSocket(Socket);
393+
394+
/* Cleanup and return */
395+
goto error;
391396
}
392397

393398
/* Make sure the Address Family is valid */
@@ -412,6 +417,7 @@ SockDoConnect(SOCKET Handle,
412417
{
413418
/* Fail: SO_BROADCAST must be set first in WinSock 2.0+ */
414419
ErrorCode = WSAEACCES;
420+
goto error;
415421
}
416422
}
417423

0 commit comments

Comments
 (0)