Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Patch for v3.3.0 #85

Open
wants to merge 2 commits into
base: origin-v3.3.0-1733934698
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 17 additions & 9 deletions src/modules/extra/m_pgsql.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ class SQLConn : public SQL::Provider, public EventHandler
q->OnError(err);
delete q;
}
Close();
}

void OnEventHandlerRead() CXX11_OVERRIDE
Expand Down Expand Up @@ -514,6 +515,9 @@ class SQLConn : public SQL::Provider, public EventHandler
{
SocketEngine::DelFd(this);

if (GetFd() != -1 && ServerInstance->SE->HasFd(GetFd()))
ServerInstance->SE->DelFd(this);

if(sql)
{
PQfinish(sql);
Expand Down Expand Up @@ -557,8 +561,13 @@ class ModulePgSQL : public Module
if (curr == connections.end())
{
SQLConn* conn = new SQLConn(this, i->second);
conns.insert(std::make_pair(id, conn));
ServerInstance->Modules->AddService(*conn);
if (conn->status != DEAD)
{
conns.insert(std::make_pair(id, conn));
ServerInstance->Modules->AddService(*conn);
}
// If the connection is dead it has already been queued for culling
// at the end of the main loop so we don't need to delete it here.
}
else
{
Expand Down Expand Up @@ -625,16 +634,15 @@ bool ReconnectTimer::Tick(time_t time)
void SQLConn::DelayReconnect()
{
ModulePgSQL* mod = (ModulePgSQL*)(Module*)creator;

ConnMap::iterator it = mod->connections.find(conf->getString("id"));
if (it != mod->connections.end())
{
mod->connections.erase(it);
ServerInstance->GlobalCulls.AddItem((EventHandler*)this);
if (!mod->retimer)
{
mod->retimer = new ReconnectTimer(mod);
ServerInstance->Timers.AddTimer(mod->retimer);
}
ServerInstance->GlobalCulls.AddItem((EventHandler*)this);
if (!mod->retimer)
{
mod->retimer = new ReconnectTimer(mod);
ServerInstance->Timers.AddTimer(mod->retimer);
}
}

Expand Down
Loading