diff options
author | Florent Le Coz <louiz@louiz.org> | 2014-03-24 18:37:31 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2014-03-24 18:37:31 +0100 |
commit | e196d2f1f400f5c9634ed42fcbdf5c5fb63a13fb (patch) | |
tree | f9a7d32d4bb9d480df36ac4dbc0fa6d8a5149200 /src/network/socket_handler.cpp | |
parent | 3b1bf740a3299e3373916fd343492420550464e1 (diff) | |
download | biboumi-e196d2f1f400f5c9634ed42fcbdf5c5fb63a13fb.tar.gz biboumi-e196d2f1f400f5c9634ed42fcbdf5c5fb63a13fb.tar.bz2 biboumi-e196d2f1f400f5c9634ed42fcbdf5c5fb63a13fb.tar.xz biboumi-e196d2f1f400f5c9634ed42fcbdf5c5fb63a13fb.zip |
Do not send data if we are connected, send it only once we actually are
Diffstat (limited to 'src/network/socket_handler.cpp')
-rw-r--r-- | src/network/socket_handler.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/network/socket_handler.cpp b/src/network/socket_handler.cpp index 3f4c01d..f344786 100644 --- a/src/network/socket_handler.cpp +++ b/src/network/socket_handler.cpp @@ -238,7 +238,14 @@ void SocketHandler::send_data(std::string&& data) if (data.empty()) return ; this->out_buf.emplace_back(std::move(data)); - this->poller->watch_send_events(this); + if (this->connected) + this->poller->watch_send_events(this); +} + +void SocketHandler::send_pending_data() +{ + if (this->connected && !this->out_buf.empty()) + this->poller->watch_send_events(this); } bool SocketHandler::is_connected() const |