MCPcopy Create free account
hub / github.com/apache/cloudberry / pqWaitTimed

Function pqWaitTimed

src/interfaces/libpq/fe-misc.c:1084–1102  ·  view source on GitHub ↗

* pqWaitTimed: wait, but not past finish_time. * * finish_time = ((time_t) -1) disables the wait limit. * * Returns -1 on failure, 0 if the socket is readable/writable, 1 if it timed out. */

Source from the content-addressed store, hash-verified

1082 * Returns -1 on failure, 0 if the socket is readable/writable, 1 if it timed out.
1083 */
1084int
1085pqWaitTimed(int forRead, int forWrite, PGconn *conn, time_t finish_time)
1086{
1087 int result;
1088
1089 result = pqSocketCheck(conn, forRead, forWrite, finish_time);
1090
1091 if (result < 0)
1092 return -1; /* errorMessage is already set */
1093
1094 if (result == 0)
1095 {
1096 appendPQExpBufferStr(&conn->errorMessage,
1097 libpq_gettext("timeout expired\n"));
1098 return 1;
1099 }
1100
1101 return 0;
1102}
1103
1104/*
1105 * pgWaitTimeout: wait, but not past finish_time.

Callers 2

connectDBCompleteFunction · 0.85
pqWaitFunction · 0.85

Calls 3

pqSocketCheckFunction · 0.85
appendPQExpBufferStrFunction · 0.85
libpq_gettextFunction · 0.85

Tested by

no test coverage detected