* 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. */
| 1082 | * Returns -1 on failure, 0 if the socket is readable/writable, 1 if it timed out. |
| 1083 | */ |
| 1084 | int |
| 1085 | pqWaitTimed(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. |
no test coverage detected