diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-11 04:39:51 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2007-01-11 04:39:51 +0000 |
commit | 300b27d0bb035c11b81c2e07541b5c194b1f9031 (patch) | |
tree | 6b004f417059181a5ca4c55ebefef603a4eb0440 | |
parent | c662a37341e9787ca8c5e553b3d641a19e3b81c8 (diff) |
Only use force if necessary! Tidy up debug output.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6296 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/modules/extra/m_pgsql.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp index ae655495e..fc383d4e9 100644 --- a/src/modules/extra/m_pgsql.cpp +++ b/src/modules/extra/m_pgsql.cpp @@ -690,7 +690,7 @@ class SQLConn : public EventHandler //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_WRITING"); Instance->SE->WantWrite(this); status = CWRITE; - return true; + return DoPoll(); case PGRES_POLLING_READING: //ServerInstance->Log(DEBUG, "PGresetPoll: PGRES_POLLING_READING"); status = CREAD; @@ -712,6 +712,14 @@ class SQLConn : public EventHandler { switch(PQstatus(sql)) { + case CONNECTION_OK: + Instance->Log(DEBUG, "PQstatus: CONNECTION_OK: Can proceed to connect."); + break; + + case CONNECTION_BAD: + Instance->Log(DEBUG, "PQstatus: CONNECTION_BAD: Connection is closed."); + break; + case CONNECTION_STARTED: Instance->Log(DEBUG, "PQstatus: CONNECTION_STARTED: Waiting for connection to be made."); break; @@ -934,16 +942,24 @@ class SQLConn : public EventHandler void DoClose() { - Instance->Log(DEBUG,"SQLConn::Close"); - Instance->Log(DEBUG, "FD IS: %d", this->fd); + Instance->Log(DEBUG, "SQLConn::Close - socket: %d", this->fd); - if (!this->Instance->SE->DelFd(this, true)) + if (!this->Instance->SE->DelFd(this)) { - Instance->Log(DEBUG, "PQsocket cant be removed from the socket engine!"); + if (sql && PQstatus(sql) == CONNECTION_BAD) + { + Instance->Log(DEBUG, "PQsocket was already removed. Forcing removal from the socket engine!"); + this->Instance->SE->DelFd(this, true); + } + else + { + Instance->Log(DEBUG, "PQsocket cant be removed from the socket engine!"); + } } else { - Instance->Log(DEBUG, "FD WAS REMOVED!"); + Instance->Log(DEBUG, "PQsocket could not be removed!"); } + if(sql) { PQfinish(sql); |