mirror of https://gitee.com/bigwinds/arangodb
fixed error messages in simplehttpclient
This commit is contained in:
parent
ead3f2f204
commit
0686cfdbd0
|
@ -175,10 +175,20 @@ bool ClientConnection::prepare (const double timeout, const bool isWrite) const
|
|||
readFds = &fdset;
|
||||
}
|
||||
|
||||
if (select(_socket + 1, readFds, writeFds, NULL, &tv) > 0) {
|
||||
int res = select(_socket + 1, readFds, writeFds, NULL, &tv);
|
||||
if (res > 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (res == 0) {
|
||||
if (isWrite) {
|
||||
TRI_set_errno(TRI_SIMPLE_CLIENT_COULD_NOT_WRITE);
|
||||
}
|
||||
else {
|
||||
TRI_set_errno(TRI_SIMPLE_CLIENT_COULD_NOT_READ);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -187,7 +197,7 @@ bool ClientConnection::prepare (const double timeout, const bool isWrite) const
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool ClientConnection::writeClientConnection (void* buffer, size_t length, size_t* bytesWritten) {
|
||||
if (!checkSocket()) {
|
||||
if (! checkSocket()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -212,7 +222,7 @@ bool ClientConnection::writeClientConnection (void* buffer, size_t length, size_
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
bool ClientConnection::readClientConnection (StringBuffer& stringBuffer) {
|
||||
if (!checkSocket()) {
|
||||
if (! checkSocket()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -221,7 +231,7 @@ bool ClientConnection::readClientConnection (StringBuffer& stringBuffer) {
|
|||
do {
|
||||
char buffer[READBUFFER_SIZE];
|
||||
|
||||
int lenRead = TRI_READ_SOCKET(_socket, buffer, READBUFFER_SIZE - 1,0);
|
||||
int lenRead = TRI_READ_SOCKET(_socket, buffer, READBUFFER_SIZE - 1, 0);
|
||||
|
||||
if (lenRead == -1) {
|
||||
// error occurred
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace triagens {
|
|||
|
||||
TRI_set_errno(TRI_ERROR_NO_ERROR);
|
||||
if (! _connection->handleWrite(remainingTime, (void*) (_writeBuffer.c_str() + _written), _writeBuffer.length() - _written, &bytesWritten)) {
|
||||
setErrorMessage("Couldn't send data to server", errno);
|
||||
setErrorMessage(TRI_last_error(), false);
|
||||
this->close();
|
||||
}
|
||||
else {
|
||||
|
@ -125,7 +125,7 @@ namespace triagens {
|
|||
}
|
||||
}
|
||||
else {
|
||||
setErrorMessage("Couldn't read data from server", errno);
|
||||
setErrorMessage(TRI_last_error(), false);
|
||||
this->close();
|
||||
}
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue