yse / easy_profiler

Lightweight profiler library for c++
MIT License
2.14k stars 184 forks source link

Receiving data in GUI often hangs on Windows #168

Open GeoffSmith13 opened 4 years ago

GeoffSmith13 commented 4 years ago

Roughly 50% of the time when stopping the capture and starting the data receiving stage, it gets stuck. It looks like the problem might be in SocketListener::listenCapture(), specifically calling m_easySocket.receive(). The receive function will always return a -1 when it hangs like this.

The code block being referred to is this:


while (bytes < sizeof(profiler::net::Message))
{
    int receivedBytes = m_easySocket.receive(buffer + seek + bytes, buffer_size);
    if (receivedBytes < 1)
    {
        bytes = receivedBytes;
        break;
    }
    bytes += receivedBytes;
}