Skip to content

Commit

Permalink
Make pg_ping report -2 on connection drop
Browse files Browse the repository at this point in the history
  • Loading branch information
stash committed Oct 12, 2009
1 parent 6e5cc9f commit c034171
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions dbdimp.c
Expand Up @@ -465,10 +465,14 @@ int dbd_db_ping (SV * dbh)
return -1;
}

if (imp_dbh->coro_error != COERR_OK) {
if (TEND) TRC(DBILOGFP, "%sEnd dbd_pg_ping (result: -4 coro error)\n", THEADER);
return -4;
if (imp_dbh->coro_error == COERR_PGFATAL) {
if (TEND || TCORO) TRC(DBILOGFP, "%sEnd dbd_pg_ping (result: -2 coro)\n", THEADER);
return -2;
}
else if (imp_dbh->coro_error != COERR_OK) {
if (TEND || TCORO) TRC(DBILOGFP, "%sEnd dbd_pg_ping (result: -4 coro)\n", THEADER);
return -4;
}

tstatus = pg_db_txn_status(aTHX_ imp_dbh);

Expand Down Expand Up @@ -5014,7 +5018,7 @@ static int coro_flush (pTHX_ imp_dbh_t *imp_dbh)
imp_dbh->coro_error = COERR_PGFATAL;
if (TEND || TCORO) {
TRACE_PQERRORMESSAGE;
TRC(DBILOGFP, "%sEnd coro_flush %d (%s)\n", THEADER, imp_dbh->socket_fd, PQerrorMessage(imp_dbh->conn));
TRC(DBILOGFP, "%sEnd coro_flush %d (Conn error: %s)\n", THEADER, imp_dbh->socket_fd, PQerrorMessage(imp_dbh->conn));
}
return -1;
}
Expand Down

0 comments on commit c034171

Please sign in to comment.