asio: asio-cl: Shutdown session on closure of first stream

This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-07 01:42:01 +09:00
parent ceefddd332
commit 45164b6761
1 changed files with 2 additions and 1 deletions

View File

@ -77,13 +77,14 @@ int main(int argc, char *argv[]) {
res.on_data([&sess](const uint8_t *data, std::size_t len) {
if (len == 0) {
// eof
sess.shutdown();
return;
}
std::cerr.write(reinterpret_cast<const char *>(data), len);
std::cerr << std::endl;
});
});
req->on_close([&sess](uint32_t error_code) { sess.shutdown(); });
});
sess.on_error([](const boost::system::error_code &ec) {