Set connected to false if error occur
This commit is contained in:
parent
3a6bacb529
commit
aa8d4a0f9d
1 changed files with 4 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue