write_blocked = true ;
return 0;
} else {
- this->handleError (result);
+ this->handleError (errorNumber());
close();
return -1;
}
} else if (isNonBlockingError ()) {
return 0;
} else {
- this->handleError (result);
+ this->handleError (errorNumber());
close();
return -1;
}
return 0;
} else {
// some other error condition
- handleError (result);
+ handleError (errorNumber());
close();
return -1;
}
void NetChannel::handleError (int error)
{
+ if (error == EINPROGRESS) {
+ // this shoudl never happen, because we should use isNonBlocking to check
+ // such error codes.
+ SG_LOG(SG_IO, SG_WARN, "Got EINPROGRESS at NetChannel::handleError: suggests broken logic somewhere else");
+ return; // not an actual error, don't warn
+ }
+
// warn about address lookup failures seperately, don't warn again.
// (and we (ab-)use ENOENT to mean 'name not found'.
if (error != ENOENT) {
assert(channel->poller == this);
channel->poller = NULL;
+ // portability: MSVC throws assertion failure when empty
+ if (channels.empty()) {
+ return;
+ }
+
ChannelList::iterator it = channels.begin();
for (; it != channels.end(); ++it) {
if (*it == channel) {