pike.git / lib / modules / Sql.pmod / pgsql_util.pmod

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:173:    final int stashflushmode;    final int stashcount;    final int synctransact;   #ifdef PG_DEBUG    final int queueoutidx;    final int queueinidx=-1;   #endif       private inline void queueup(sql_result portal) {    qportals->write(portal); portal->_synctransact=synctransact; -  PD(">%O %d %d Queue portal %d bytes\n",portal._portalname,++queueoutidx, -  synctransact,sizeof(this)); +  PD("%d>%O %d %d Queue portal %d bytes\n",socket->query_fd(), +  portal._portalname,++queueoutidx,synctransact,sizeof(this));    }       final conxion|bufcon start(void|int waitforreal) {    Thread.MutexKey lock;    if(lock=(waitforreal?nostash->lock:nostash->trylock)(1)) {    started=lock;    lock=stashupdate->lock();    if(stashcount)    stashavail.wait(lock);    add(stash); stash->clear();
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:222:    private int read_cb(mixed id,mixed b) {    Thread.MutexKey lock=fillreadmux->lock();    if(fillread)    fillread.signal();    lock=0;    return 0;    }       private int write_cb() {    towrite-=output_to(socket,towrite); -  if(!fillread && !sizeof(this)) +  if(!fillread && !sizeof(this)) { +  PD("%d>Close socket delayed\n",socket->query_fd());    socket->close(); -  +  }    return 0;    }       final inline int consume(int w) { return i::consume(w); }    final inline int unread(int w) { return i::unread(w); }    final inline string read(int w) { return i::read(w); }    final inline object read_buffer(int w) { return i::read_buffer(w); }    final inline int read_sint(int w) { return i::read_sint(w); }    final inline int read_int8() { return i::read_int8(); }    final inline int read_int16() { return i::read_int16(); }
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:246:       final void sendcmd(void|sctype mode,void|sql_result portal) {    if(portal)    queueup(portal);   nosync:    do {    switch(mode) {    default:    break nosync;    case syncsend: -  PD(">Sync %d %d Queue\n",synctransact,++queueoutidx); +  PD("%d>Sync %d %d Queue\n", +  socket->query_fd(),synctransact,++queueoutidx);    add(PGSYNC);    mode=sendout;    break;    case flushlogsend: -  PD(">%O %d Queue simplequery %d bytes\n",portal._portalname, -  ++queueoutidx,sizeof(this)); +  PD("%d>%O %d Queue simplequery %d bytes\n", +  socket->query_fd(),portal._portalname,++queueoutidx,sizeof(this));    mode=flushsend;    }    qportals->write(synctransact++);    } while(0);    if(started) {    Thread.MutexKey lock=stashupdate->lock();    if(sizeof(stash)) {    add(stash); stash->clear();    foreach(stashqueue->try_read_array();;sql_result portal)    queueup(portal);
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:280:    do {    switch(mode) {    default:    break outer;    case flushsend:    PD("Flush\n");    add(PGFLUSH);    case sendout:;    }    if(towrite=sizeof(this)) { -  PD(">Sendcmd %O\n",((string)this)[..towrite-1]); +  PD("%d>Sendcmd %O\n",socket->query_fd(),((string)this)[..towrite-1]);    towrite-=output_to(socket,towrite);    }    } while(0);    started=0;    return;    };    if(pgsqlsess)    pgsqlsess->_connectfail();    }       final void sendterminate() {    destruct(fillread); // Delayed close() after flushing the output buffer    }       final int close() {    destruct(nostash); -  +  PD("%d>Close socket\n",socket->query_fd());    return socket->close();    }       protected void destroy() {    catch(close()); // Exceptions don't work inside destructors    pgsqlsess=0;    }       final void connectloop(int nossl) {    mixed err=catch {
pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:322: Inside #if constant(SSL.File)
   PD("SSLRequest\n");    start()->add_int32(8)->add_int32(PG_PROTOCOL(1234,5679))    ->sendcmd(sendout);    switch(read_int8()) {    case 'S':    object fcon=SSL.File(socket,SSL.Context());    if(fcon->connect()) {    socket=fcon;    break;    } -  default:socket->close(); +  default:PD("%d>Close socket\n",socket->query_fd()); +  socket->close();    pgsqlsess.nossl=1;    continue;    case 'N':    if(pgsqlsess._options.force_ssl)    error("Encryption not supported on connection to %s:%d\n",    pgsqlsess.host,pgsqlsess.port);    }    }   #else    if(pgsqlsess._options.force_ssl)