Skip to content
Snippets Groups Projects
Commit 601713af authored by Stephen R. van den Berg's avatar Stephen R. van den Berg
Browse files

pgsql: Catch even more double traps.

parent f29f6876
No related branches found
No related tags found
No related merge requests found
...@@ -270,7 +270,8 @@ protected void create(void|string host, void|string database, ...@@ -270,7 +270,8 @@ protected void create(void|string host, void|string database,
&& (t = time(1)) - lastping > MINPINGINTERVAL && (t = time(1)) - lastping > MINPINGINTERVAL
&& (ret = !catch(proxy.c->start()->sendcmd(FLUSHSEND)))) && (ret = !catch(proxy.c->start()->sendcmd(FLUSHSEND))))
lastping = t; lastping = t;
return ret ? !!reconnected : -1; // After catch(start()) we might have been destructed
return this && ret ? !!reconnected : -1;
} }
//! Cancels all currently running queries in this session. //! Cancels all currently running queries in this session.
......
...@@ -1569,13 +1569,16 @@ class sql_result { ...@@ -1569,13 +1569,16 @@ class sql_result {
array(Thread.MutexKey) reflock = ({ 0 }); array(Thread.MutexKey) reflock = ({ 0 });
for (;;) { for (;;) {
reflock[0] = closemux->lock(aborted); reflock[0] = closemux->lock(aborted);
if (!catch(plugbuffer = c->start(reflock))) if (!catch(plugbuffer = c->start(reflock))) {
if (!this) // If dead
return;
if (plugbuffer) if (plugbuffer)
plugbuffer->sendcmd(_closeportal(plugbuffer, reflock)); plugbuffer->sendcmd(_closeportal(plugbuffer, reflock));
else { else {
PD("Releasesession retry closemux %O\n", _portalname); PD("Releasesession retry closemux %O\n", _portalname);
continue; continue;
} }
}
break; break;
} }
reflock[0] = 0; reflock[0] = 0;
...@@ -1962,9 +1965,11 @@ class proxy { ...@@ -1962,9 +1965,11 @@ class proxy {
PD("%O\n", (string)plugbuffer); PD("%O\n", (string)plugbuffer);
void|bufcon|conxsess cs; void|bufcon|conxsess cs;
if (catch(cs = ci->start())) { if (catch(cs = ci->start())) {
destruct(waitforauthready); if (this) { // Only if still alive
unnamedstatement = 0; destruct(waitforauthready);
termlock = 1; unnamedstatement = 0;
termlock = 1;
}
return; return;
} else { } else {
CHAIN(cs)->add_hstring(plugbuffer, 4, 4); CHAIN(cs)->add_hstring(plugbuffer, 4, 4);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment