- fixed bug in windows socket layer

pull/211/head
Michael Zillgith 6 years ago
parent 8991954e3c
commit b82a78db46

@ -1,7 +1,7 @@
/* /*
* socket_win32.c * socket_win32.c
* *
* Copyright 2013-2018 Michael Zillgith * Copyright 2013-2020 Michael Zillgith
* *
* This file is part of libIEC61850. * This file is part of libIEC61850.
* *
@ -296,8 +296,13 @@ ServerSocket_setBacklog(ServerSocket self, int backlog)
void void
ServerSocket_destroy(ServerSocket self) ServerSocket_destroy(ServerSocket self)
{ {
if (self->fd != INVALID_SOCKET) {
shutdown(self->fd, 2);
closesocket(self->fd); closesocket(self->fd);
socketCount--; socketCount--;
self->fd = INVALID_SOCKET;
}
wsaShutdown(); wsaShutdown();
GLOBAL_FREEMEM(self); GLOBAL_FREEMEM(self);
} }
@ -575,10 +580,14 @@ void
Socket_destroy(Socket self) Socket_destroy(Socket self)
{ {
if (self->fd != INVALID_SOCKET) { if (self->fd != INVALID_SOCKET) {
shutdown(self->fd, 2);
closesocket(self->fd); closesocket(self->fd);
}
self->fd = INVALID_SOCKET;
socketCount--; socketCount--;
}
wsaShutdown(); wsaShutdown();
GLOBAL_FREEMEM(self); GLOBAL_FREEMEM(self);

Loading…
Cancel
Save