PIPeer important fix!
git-svn-id: svn://db.shs.com.ru/pip@113 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
@@ -272,7 +272,7 @@ bool PIEthernet::closeDevice() {
|
||||
|
||||
void PIEthernet::closeSocket(int & sd) {
|
||||
if (sd != -1)
|
||||
ethClosesocket(sd);
|
||||
ethClosesocket(sd, type() != PIEthernet::UDP);
|
||||
sd = -1;
|
||||
}
|
||||
|
||||
@@ -1035,13 +1035,14 @@ int PIEthernet::ethSendto(int sock, const void * buf, int size, int flags, socka
|
||||
}
|
||||
|
||||
|
||||
void PIEthernet::ethClosesocket(int sock) {
|
||||
void PIEthernet::ethClosesocket(int sock, bool shutdown) {
|
||||
if (sock < 0) return;
|
||||
if (shutdown) ::shutdown(sock,
|
||||
#ifdef WINDOWS
|
||||
shutdown(sock, SD_BOTH);
|
||||
SD_BOTH);
|
||||
closesocket(sock);
|
||||
#else
|
||||
shutdown(sock, SHUT_RDWR);
|
||||
SHUT_RDWR);
|
||||
::close(sock);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user