diff options
author | George Hazan <george.hazan@gmail.com> | 2015-04-11 18:02:05 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-04-11 18:02:05 +0000 |
commit | ba0b00d71dc0296ac25fb356c5a29604f4b45776 (patch) | |
tree | f818e757e755f0ae474bf3e29435e513fed3c5b9 /src/modules/netlib | |
parent | 5860633d22c07e1e225bdc4b0780f56dd025b68c (diff) |
no need to bind unopened socket
git-svn-id: http://svn.miranda-ng.org/main/trunk@12770 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/netlib')
-rw-r--r-- | src/modules/netlib/netlibbind.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/modules/netlib/netlibbind.cpp b/src/modules/netlib/netlibbind.cpp index e939fc82c1..699799dd17 100644 --- a/src/modules/netlib/netlibbind.cpp +++ b/src/modules/netlib/netlibbind.cpp @@ -229,7 +229,8 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) sin.sin_port = htons(nlb->wPort);
sin6.sin6_port = htons(nlb->wPort);
}
-
+
+ if (nlbp->s != INVALID_SOCKET)
if (bind(nlbp->s, (PSOCKADDR)&sin, sizeof(sin)) == 0) {
SOCKADDR_IN sin = { 0 };
int len = sizeof(sin);
@@ -238,8 +239,9 @@ INT_PTR NetlibBindPort(WPARAM wParam, LPARAM lParam) foundPort = 1;
}
- if (bind(nlbp->s6, (PSOCKADDR)&sin6, sizeof(sin6)) == 0)
- foundPort = 1;
+ if (nlbp->s6 != INVALID_SOCKET)
+ if (bind(nlbp->s6, (PSOCKADDR)&sin6, sizeof(sin6)) == 0)
+ foundPort = 1;
}
if (!foundPort) {
NetlibLogf(nlu, "%s %d: %s() failed (%u)", __FILE__, __LINE__, "bind", WSAGetLastError());
|