Skip to content
Snippets Groups Projects
Commit 3ea8786f authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

%[ER: 231]%

Socket::shutdown() no longer closes the socket; this is now done by
Socket::close(). Otherwise you would get an error when Socket::~Socket() calls
Socket::close() to close an already closed socket.
parent 5857d55d
No related branches found
No related tags found
No related merge requests found
...@@ -643,16 +643,18 @@ Socket* Socket::accept(int32 waitMs) ...@@ -643,16 +643,18 @@ Socket* Socket::accept(int32 waitMs)
int32 Socket::close() int32 Socket::close()
{ {
if (itsSocketID < 0) { if (itsSocketID < 0) {
return itsErrno = NOINIT; return itsErrno = NOINIT;
} }
if (itsIsConnected) {
LOG_TRACE_FLOW(formatString("close(%d)", itsSocketID)); LOG_TRACE_FLOW(formatString("close(%d)", itsSocketID));
if (::close(itsSocketID) < 0) { if (::close(itsSocketID) < 0) {
return setErrno(CLOSE); return setErrno(CLOSE);
} }
}
return itsErrno = SK_OK; itsSocketID = -1;
itsIsConnected = false;
return itsErrno = SK_OK;
} }
// //
...@@ -679,11 +681,9 @@ int32 Socket::shutdown (bool receive, bool send) ...@@ -679,11 +681,9 @@ int32 Socket::shutdown (bool receive, bool send)
} }
} }
if (send && receive) { // update administration if (send && receive) { // update administration
::close(itsSocketID);
itsSocketID = -1;
itsIsConnected = false; itsIsConnected = false;
} }
return (itsErrno); return (itsErrno);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment