Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ISteamNetworkingMessages.ReceiveMessagesOnChannel blocks forever sometimes #324

Open
winterSteve25 opened this issue Aug 6, 2024 · 2 comments

Comments

@winterSteve25
Copy link

winterSteve25 commented Aug 6, 2024

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!

@zpostfacto
Copy link
Contributor

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?

@winterSteve25
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants