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

version» Context lines:

pike.git/lib/modules/Sql.pmod/pgsql_util.pmod:331:    }    } while(0);    lock=started=0;    return;    };    lock=0;    catch(connectfail());    }       final int close() { -  int ret=0; -  if(!closenext && nostash) -  { Thread.MutexKey lock=i->fillreadmux->lock(); +  if(!closenext && nostash) { +  closenext=1; +  Thread.MutexKey lock=i->fillreadmux->lock();    if(i->fillread) { // Delayed close() after flushing the output buffer    i->fillread.signal();    i->fillread=0;    }    lock=0;    PD("%d>Delayed close, flush write\n",socket->query_fd());    i->read_cb(socket->query_id(),0); -  closenext=1; -  } else { +  return 0; +  } else +  return -1; +  } +  +  protected void destroy() { +  if(nostash) { +  catch {    destruct(nostash);    PD("%d>Close socket\n",socket->query_fd()); -  ret=socket->close(); +  socket->close();    foreach(closecallbacks;function(void|mixed:void) closecb;)    closecb();    closecallbacks=(<>); -  +  };    } -  return ret; -  } -  -  protected void destroy() { -  catch(close()); // Exceptions don't work inside destructors +     connectfail=0;    }       final void connectloop(object pgsqlsess, int nossl) {    mixed err=catch {    for(;;clear()) {    socket->connect(pgsqlsess._host,pgsqlsess._port);   #if constant(SSL.File)    if(!nossl && !pgsqlsess->nossl    && (pgsqlsess._options.use_ssl || pgsqlsess._options.force_ssl)) {