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