From 3bfe0553d1f979ad3bc62d7561eb800e8c37d889 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 8 Feb 2012 01:33:55 +0900 Subject: [PATCH] Call both Spdylay::recv and Spdylay::send on either POLLIN or POLLOUT --- examples/spdycat.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/spdycat.cc b/examples/spdycat.cc index 9856e2b..6662c1b 100644 --- a/examples/spdycat.cc +++ b/examples/spdycat.cc @@ -179,11 +179,12 @@ 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;