pike.git
/
lib
/
modules
/
Sql.pmod
/
pgsql.pike
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/lib/modules/Sql.pmod/pgsql.pike:1235:
} else if(err) _delayederror=err; } private int reconnect(void|int force) { PD("(Re)connect\n"); if(!force) { Thread.MutexKey lock=_shortmux->lock(); if(waitforauthready) { lock=0;
-
return
0
; // Connect still in progress in other thread
+
return
1
; // Connect still in progress in other thread
} waitforauthready=Thread.Condition(); lock=0; } if(c) { PD("Close old connection\n"); reconnected++; #ifdef PG_STATS prepstmtused=0; #endif if(!force) c->sendterminate(); else c->close(); c=0; PD("Flushing old cache\n"); foreach(_prepareds;;mapping tp) m_delete(tp,"preparedname");
-
if(!_options.reconnect)
+
if(!_options.reconnect)
{
+
string msg=sprintf("Lost connection to database %s:%d",_host,_port);
+
if(force) {
+
lastmessage+=({msg});
return 0;
-
+
} else
+
ERROR(msg+"\n");
}
-
+
}
PD("Actually start to connect\n"); qportals=Thread.Queue(); _readyforcommit=Thread.Condition(); _readyforquerycount=1; _waittocommit=0; qportals->write(1); if(!(c=getsocket())) { string msg=sprintf("Couldn't connect to database on %s:%d",_host,_port); if(force) { if(!sizeof(lastmessage) || lastmessage[sizeof(lastmessage)-1]!=msg)