mirror of
https://github.com/yse/easy_profiler.git
synced 2024-12-27 08:41:02 +08:00
Check if receive return zero - set it to disconnect
This commit is contained in:
parent
d2b4423c7b
commit
9b7b80febe
@ -361,6 +361,11 @@ void EasyMainWindow::listen()
|
||||
|
||||
char *buf = &buffer[seek];
|
||||
|
||||
if(bytes == 0){
|
||||
isListen = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (bytes > 0)
|
||||
{
|
||||
profiler::net::Message* message = (profiler::net::Message*)buf;
|
||||
|
@ -73,6 +73,9 @@ int EasySocket::receive(void *buf, size_t nbyte)
|
||||
if(m_replySocket <= 0) return -1;
|
||||
int res = ::read(m_replySocket,buf,nbyte);
|
||||
checkResult(res);
|
||||
if (res == 0){
|
||||
m_state = CONNECTION_STATE_DISCONNECTED;
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -242,6 +245,10 @@ int EasySocket::receive(void *buf, size_t nbyte)
|
||||
|
||||
int res = ::recv(m_replySocket, (char*)buf, nbyte, 0);
|
||||
checkResult(res);
|
||||
if (res == 0){
|
||||
m_state = CONNECTION_STATE_DISCONNECTED;
|
||||
}
|
||||
|
||||
/**
|
||||
if (res == SOCKET_ERROR)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user