Permalink
Browse files

In event loop condition, only consider spdylay_session_want_{read,wri…

…te}.
  • Loading branch information...
1 parent a87303a commit 4d8273a05254d6f7dc6cdedcbc62611d94a8f039 @tatsuhiro-t tatsuhiro-t committed Apr 27, 2012
Showing with 10 additions and 2 deletions.
  1. +2 −1 examples/SpdyServer.cc
  2. +1 −1 examples/spdycat.cc
  3. +6 −0 examples/spdylay_ssl.cc
  4. +1 −0 examples/spdylay_ssl.h
View
@@ -236,7 +236,8 @@ int SpdyEventHandler::fd() const
bool SpdyEventHandler::finish()
{
- return !want_read() && !want_write();
+ return !spdylay_session_want_read(session_) &&
+ !spdylay_session_want_write(session_);
}
ssize_t SpdyEventHandler::send_data(const uint8_t *data, size_t len, int flags)
View
@@ -336,7 +336,7 @@ int communicate(const std::string& host, uint16_t port,
int timeout = config.timeout;
bool ok = true;
- while(sc.want_read() || sc.want_write()) {
+ while(!sc.finish()) {
int nfds = poll(pollfds, npollfds, timeout);
if(nfds == -1) {
perror("poll");
View
@@ -101,6 +101,12 @@ bool Spdylay::want_write()
return spdylay_session_want_write(session_) || want_write_;
}
+bool Spdylay::finish()
+{
+ return !spdylay_session_want_read(session_) &&
+ !spdylay_session_want_write(session_);
+}
+
int Spdylay::fd() const
{
return fd_;
View
@@ -49,6 +49,7 @@ class Spdylay {
ssize_t recv_data(uint8_t *data, size_t len, int flags);
bool want_read();
bool want_write();
+ bool finish();
int fd() const;
int submit_request(const std::string& hostport, const std::string& path,
uint8_t pri, void *stream_user_data);

0 comments on commit 4d8273a

Please sign in to comment.