summaryrefslogtreecommitdiff
path: root/example/stream.cc
diff options
context:
space:
mode:
authorfrsyuki <frsyuki@users.sourceforge.jp>2009-08-07 11:28:23 +0900
committerfrsyuki <frsyuki@users.sourceforge.jp>2009-08-07 11:28:23 +0900
commitb4cb5e23c0a235d61d4a63acf4624f96f20f620b (patch)
tree7b1f39bc796eaf54e49663117f2e73596469e47a /example/stream.cc
parent1375732c805264cf43baa112a5a45e4c0c43b8e6 (diff)
downloadmsgpack-python-b4cb5e23c0a235d61d4a63acf4624f96f20f620b.tar.gz
fix Makefile.am
Diffstat (limited to 'example/stream.cc')
-rw-r--r--example/stream.cc10
1 files changed, 5 insertions, 5 deletions
diff --git a/example/stream.cc b/example/stream.cc
index 1e2e733..2241935 100644
--- a/example/stream.cc
+++ b/example/stream.cc
@@ -22,14 +22,14 @@ public:
ssize_t count =
read(m_sock, m_pac.buffer(), m_pac.buffer_capacity());
- if(count < 0) {
+ if(count <= 0) {
+ if(count == 0) {
+ throw std::runtime_error("connection closed");
+ }
if(errno == EAGAIN || errno == EINTR) {
return;
- } else {
- throw std::runtime_error(strerror(errno));
}
- } else if(count == 0) {
- throw std::runtime_error("connection closed");
+ throw std::runtime_error(strerror(errno));
}
m_pac.buffer_consumed(count);