Skip to content
Snippets Groups Projects
Commit c3ac7946 authored by Benny Baumann's avatar Benny Baumann
Browse files

fix: I/O handler state transition fixes

parent 234f245f
No related branches found
No related tags found
1 merge request!1First unit tests
......@@ -205,7 +205,8 @@ void tcp_client::cb_ev(::ev::io &w, int events) {
if (events & ::ev::ERROR) {
// Handle errors
// Log and throw?
return;
io.stop();
throw netio_exception("TCP client error");
}
if (events & ::ev::READ) {
......@@ -220,7 +221,8 @@ void tcp_client::cb_ev(::ev::io &w, int events) {
if (n_read_bytes == 0) {
// TODO find a way to properly announce the closed connection
delete this;
io.stop();
return;
} else {
this->in_data_cb(buffer_to_string(buffer, n_read_bytes));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment