pike.git/lib/modules/Sql.pmod/pgsql.pike:76: Inside #if defined(PG_STATS)
#ifdef PG_STATS
private int skippeddescribe; // Number of times we skipped Describe phase
private int portalsopened; // Number of portals opened
private int prepstmtused; // Number of times we used prepared statements
#endif
private int cachedepth = STATEMENTCACHEDEPTH;
private int portalbuffersize = PORTALBUFFERSIZE;
private int timeout = QUERYTIMEOUT;
private array connparmcache;
private int reconnected;
+ private int lastping = time(1);
protected string _sprintf(int type) {
string res;
switch(type) {
case 'O':
res = sprintf(DRIVERNAME"(%s@%s:%d/%s,%d,%d)",
proxy.user, proxy.host, proxy.port, proxy.database,
proxy.c?->socket && proxy.c->socket->query_fd(), proxy.backendpid);
break;
}
pike.git/lib/modules/Sql.pmod/pgsql.pike:249:
//! @int
//! @value 0
//! Everything ok.
//! @value -1
//! The server has gone away, and the connection is dead.
//! @endint
//!
//! @seealso
//! @[is_open()]
/*semi*/final int ping() {
+ int t, ret;
waitauthready();
- return is_open()
- && !catch(proxy.c->start()->sendcmd(FLUSHSEND)) ? !!reconnected : -1;
+ if ((ret = is_open())
+ // Pinging more frequently than MINPINGINTERVAL seconds
+ // is suppressed to avoid artificial TCP-ACK latency
+ && (t = time(1)) - lastping > MINPINGINTERVAL
+ && (ret = !catch(proxy.c->start()->sendcmd(FLUSHSEND))))
+ lastping = t;
+ return ret ? !!reconnected : -1;
}
//! Cancels all currently running queries in this session.
//!
//! @seealso
//! @[reload()], @[resync()]
//!
//! @note
//! This function is PostgreSQL-specific.
/*semi*/final void cancelquery() {