Call both Spdylay::recv and Spdylay::send on either POLLIN or POLLOUT

This commit is contained in:
Tatsuhiro Tsujikawa 2012-02-08 01:33:55 +09:00
parent 6904ccc023
commit 3bfe0553d1
1 changed files with 3 additions and 2 deletions

View File

@ -179,12 +179,13 @@ int communicate(const std::string& host, uint16_t port,
perror("poll");
return -1;
}
if(((pollfds[0].revents & POLLIN) && sc.recv() != 0) ||
((pollfds[0].revents & POLLOUT) && sc.send() != 0)) {
if(pollfds[0].revents & (POLLIN | POLLOUT)) {
if(sc.recv() != 0 || sc.send() != 0) {
ok = false;
std::cout << "Fatal" << std::endl;
break;
}
}
if((pollfds[0].revents & POLLHUP) || (pollfds[0].revents & POLLERR)) {
std::cout << "HUP" << std::endl;
ok = false;