ValveSoftware/GameNetworkingSockets

ISteamNetworkingMessages.ReceiveMessagesOnChannel blocks forever sometimes

winterSteve25 opened this issue · 2 comments

Hey, I am working on a little cpp project using steam networking and ISteamNetworkingMessages.ReceiveMessagesOnChannel call sometimes blocks forever.

I have class NetworkManager and in the constructor uses malloc to allocate a buffer for message pointers, and every update frame I am calling ReceiveMessagesOnChannel and sometimes this call blocks forever causing the application to freeze up, I was wondering if there is something I am doing wrong or missing

This is on windows x64

Thank you very much for your time!

Is this using the steamworks code or the opensource code here?
Can you give me a call stack, or capture a minidump, of this happening?

I'm using the steamworks sdk with their headers and precompiled dll, this is the callstack when the call to ISteamNetworkingMessages.ReceiveMessagesOnChannel occurs.

image

This is the function:

void NetworkManager::HandleMessages()
{
    int msgCount = SteamNetworkingMessages()->ReceiveMessagesOnChannel(0, m_messageBuffer, message_buffer_size);
    if (msgCount <= 0) return;

    for (int i = 0; i < msgCount; i++)
    {
        SteamNetworkingMessage_t* msg = m_messageBuffer[i];
        HandleMessage(msg);
        msg->Release();
    }
}

m_messageBuffer is type of SteamNetworkingMessage_t** initialized like so in the constructor static_cast<SteamNetworkingMessage_t**>(malloc(message_buffer_size * sizeof(SteamNetworkingMessage_t*)))

and message_buffer_size is a constexpr of 64