From 07e10a04f91e79af0928b2c548196c6980016478 Mon Sep 17 00:00:00 2001 From: Johannes Schlatow Date: Wed, 13 Jan 2016 20:42:19 +0100 Subject: [PATCH] tcp_terminal: disconnect socket on empty read The tcp_terminal kept the socket open even though the client disconnected. As a result, reconnecting to the tcp_terminal was not working. Fixes #1913 --- repos/gems/src/server/tcp_terminal/main.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/repos/gems/src/server/tcp_terminal/main.cc b/repos/gems/src/server/tcp_terminal/main.cc index c6700a01ba..e4e174b55b 100644 --- a/repos/gems/src/server/tcp_terminal/main.cc +++ b/repos/gems/src/server/tcp_terminal/main.cc @@ -191,6 +191,11 @@ class Open_socket : public Genode::List::Element /* read from socket */ _read_buf_bytes_used = ::read(_sd, _read_buf, sizeof(_read_buf)); + if (_read_buf_bytes_used == 0) { + _sd = -1; + return; + } + /* notify client about bytes available for reading */ if (_read_avail_sigh.valid()) Genode::Signal_transmitter(_read_avail_sigh).submit();