summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/modules/extra/m_pgsql.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 916f164d1..c64017d61 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -225,6 +225,7 @@ class SQLConn : public SQL::Provider, public EventHandler
q->OnError(err);
delete q;
}
+ Close();
}
void OnEventHandlerRead() CXX11_OVERRIDE
@@ -506,7 +507,9 @@ restart:
void Close()
{
status = DEAD;
- SocketEngine::DelFd(this);
+
+ if (HasFd() && SocketEngine::HasFd(GetFd()))
+ SocketEngine::DelFd(this);
if(sql)
{