|
@@ -5545,15 +5545,7 @@ CSingletonSocketConnection::CSingletonSocketConnection(SocketEndpoint &_ep)
|
|
|
|
|
|
CSingletonSocketConnection::~CSingletonSocketConnection()
|
|
CSingletonSocketConnection::~CSingletonSocketConnection()
|
|
{
|
|
{
|
|
- try {
|
|
|
|
- if (sock)
|
|
|
|
- sock->close();
|
|
|
|
- }
|
|
|
|
- catch (IException *e) {
|
|
|
|
- if (e->errorCode()!=JSOCKERR_graceful_close)
|
|
|
|
- EXCLOG(e,"CSingletonSocketConnection close");
|
|
|
|
- e->Release();
|
|
|
|
- }
|
|
|
|
|
|
+ shutdownAndCloseNoThrow(sock);
|
|
}
|
|
}
|
|
|
|
|
|
void CSingletonSocketConnection::set_keep_alive(bool keepalive)
|
|
void CSingletonSocketConnection::set_keep_alive(bool keepalive)
|
|
@@ -7106,5 +7098,21 @@ IAllowListHandler *createAllowListHandler(AllowListPopulateFunction populateFunc
|
|
return new CAllowListHandler(populateFunc, roleFormatFunc);
|
|
return new CAllowListHandler(populateFunc, roleFormatFunc);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+extern jlib_decl void shutdownAndCloseNoThrow(ISocket * optSocket)
|
|
|
|
+{
|
|
|
|
+ if (!optSocket)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ optSocket->shutdownNoThrow();
|
|
|
|
+ try
|
|
|
|
+ {
|
|
|
|
+ optSocket->close();
|
|
|
|
+ }
|
|
|
|
+ catch (IException * e)
|
|
|
|
+ {
|
|
|
|
+ e->Release();
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
static_assert(sizeof(IpAddress) == 16, "check size of IpAddress");
|
|
static_assert(sizeof(IpAddress) == 16, "check size of IpAddress");
|
|
static_assert(sizeof(SocketEndpoint) == 20, "check size of SocketEndpoint");
|
|
static_assert(sizeof(SocketEndpoint) == 20, "check size of SocketEndpoint");
|