check for CONNECTION_BAD status before calling PQsetnonblocking

This commit is contained in:
booo 2012-07-06 14:22:59 +02:00
parent 125075b796
commit 60130a933d

View File

@ -329,11 +329,6 @@ protected:
LOG("Connection couldn't be created");
}
if (PQsetnonblocking(connection_, 1) == -1) {
LOG("Unable to set connection to non-blocking");
return false;
}
ConnStatusType status = PQstatus(connection_);
if(CONNECTION_BAD == status) {
@ -341,6 +336,11 @@ protected:
return false;
}
if (PQsetnonblocking(connection_, 1) == -1) {
LOG("Unable to set connection to non-blocking");
return false;
}
int fd = PQsocket(connection_);
if(fd < 0) {
LOG("socket fd was negative. error");