Arrange #ifdef guard so that formatter does not get fooled

pull/388/head
Tatsuhiro Tsujikawa 2015-05-16 20:58:51 +09:00
parent c26da09687
commit ee12923122
1 changed files with 29 additions and 28 deletions

View File

@ -823,38 +823,39 @@ void SocketCore::readData(void* data, size_t& len)
} }
ret = 0; ret = 0;
} }
} else if(!secure_) { } else
#else
if(!secure_) {
#endif // HAVE_LIBSSH2 #endif // HAVE_LIBSSH2
// Cast for Windows recv() if(!secure_) {
while((ret = recv(sockfd_, reinterpret_cast<char*>(data), len, 0)) == -1 && // Cast for Windows recv()
SOCKET_ERRNO == A2_EINTR); while((ret = recv(sockfd_,
int errNum = SOCKET_ERRNO; reinterpret_cast<char*>(data), len, 0)) == -1 &&
if(ret == -1) { SOCKET_ERRNO == A2_EINTR);
if(!A2_WOULDBLOCK(errNum)) { int errNum = SOCKET_ERRNO;
throw DL_RETRY_EX(fmt(EX_SOCKET_RECV, errorMsg(errNum).c_str())); if(ret == -1) {
} if(!A2_WOULDBLOCK(errNum)) {
wantRead_ = true; throw DL_RETRY_EX(fmt(EX_SOCKET_RECV, errorMsg(errNum).c_str()));
ret = 0; }
}
} else {
#ifdef ENABLE_SSL
ret = tlsSession_->readData(data, len);
if(ret < 0) {
if(ret != TLS_ERR_WOULDBLOCK) {
throw DL_RETRY_EX(fmt(EX_SOCKET_RECV,
tlsSession_->getLastErrorString().c_str()));
}
if(tlsSession_->checkDirection() == TLS_WANT_READ) {
wantRead_ = true; wantRead_ = true;
} else { ret = 0;
wantWrite_ = true; }
} else {
#ifdef ENABLE_SSL
ret = tlsSession_->readData(data, len);
if(ret < 0) {
if(ret != TLS_ERR_WOULDBLOCK) {
throw DL_RETRY_EX(fmt(EX_SOCKET_RECV,
tlsSession_->getLastErrorString().c_str()));
}
if(tlsSession_->checkDirection() == TLS_WANT_READ) {
wantRead_ = true;
} else {
wantWrite_ = true;
}
ret = 0;
} }
ret = 0;
}
#endif // ENABLE_SSL #endif // ENABLE_SSL
} }
len = ret; len = ret;
} }