summaryrefslogtreecommitdiff
path: root/src/modules/extra/m_pgsql.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/extra/m_pgsql.cpp')
-rw-r--r--src/modules/extra/m_pgsql.cpp50
1 files changed, 14 insertions, 36 deletions
diff --git a/src/modules/extra/m_pgsql.cpp b/src/modules/extra/m_pgsql.cpp
index 109725a43..c454befae 100644
--- a/src/modules/extra/m_pgsql.cpp
+++ b/src/modules/extra/m_pgsql.cpp
@@ -55,14 +55,20 @@ class ModulePgSQL;
typedef insp::flat_map<std::string, SQLConn*> ConnMap;
-/* CREAD, Connecting and wants read event
- * CWRITE, Connecting and wants write event
- * WREAD, Connected/Working and wants read event
- * WWRITE, Connected/Working and wants write event
- * RREAD, Resetting and wants read event
- * RWRITE, Resetting and wants write event
- */
-enum SQLstatus { CREAD, CWRITE, WREAD, WWRITE, RREAD, RWRITE };
+enum SQLstatus
+{
+ // Connecting and wants read event.
+ CREAD,
+
+ // Connecting and wants write event.
+ CWRITE,
+
+ // Connected/working and wants read event.
+ WREAD,
+
+ // Connected/working and wants write event.
+ WWRITE
+};
class ReconnectTimer : public Timer
{
@@ -385,30 +391,6 @@ restart:
}
}
- bool DoResetPoll()
- {
- switch(PQresetPoll(sql))
- {
- case PGRES_POLLING_WRITING:
- SocketEngine::ChangeEventMask(this, FD_WANT_POLL_WRITE | FD_WANT_NO_READ);
- status = CWRITE;
- return DoPoll();
- case PGRES_POLLING_READING:
- SocketEngine::ChangeEventMask(this, FD_WANT_POLL_READ | FD_WANT_NO_WRITE);
- status = CREAD;
- return true;
- case PGRES_POLLING_FAILED:
- return false;
- case PGRES_POLLING_OK:
- SocketEngine::ChangeEventMask(this, FD_WANT_POLL_READ | FD_WANT_NO_WRITE);
- status = WWRITE;
- DoConnectedPoll();
- return true;
- default:
- return true;
- }
- }
-
void DelayReconnect();
void DoEvent()
@@ -417,10 +399,6 @@ restart:
{
DoPoll();
}
- else if((status == RREAD) || (status == RWRITE))
- {
- DoResetPoll();
- }
else
{
DoConnectedPoll();