From aa8d4a0f9d450b10b3a1714521a368c36092ec47 Mon Sep 17 00:00:00 2001 From: Micke Prag Date: Thu, 28 Oct 2010 14:29:46 +0000 Subject: [PATCH] Set connected to false if error occur --- telldus-core/common/Socket_unix.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/telldus-core/common/Socket_unix.cpp b/telldus-core/common/Socket_unix.cpp index 5e5025dc..a86a1aa4 100644 --- a/telldus-core/common/Socket_unix.cpp +++ b/telldus-core/common/Socket_unix.cpp @@ -80,7 +80,9 @@ void Socket::stopReadWait(){ } void Socket::write(const std::wstring &msg) { - //TODO set d->conneted to false if something goes wrong std::string newMsg(msg.begin(), msg.end()); - send(d->socket, newMsg.c_str(), newMsg.length(), 0); + int sent = send(d->socket, newMsg.c_str(), newMsg.length(), 0); + if (sent < 0) { + d->connected = false; + } }