Giter Site home page Giter Site logo

Comments (3)

gafferongames avatar gafferongames commented on June 2, 2024

I agree that an early out with an error (assert) is appropriate, since this is on send, and you should configure the channel size to be larger in this case. -- cheers

from yojimbo.

dbechrd avatar dbechrd commented on June 2, 2024

I just encountered this exact same problem and it took me quite awhile in the debugger looking through the yojimbo internals to figure out why my packet just silently disappeared on a reliable channel. This definitely needs an assert or some kind of obvious error. How can I even preventatively check for this before calling SendMessage()? I don't see any obvious way in my Serialize() function to know when I've serialized too much data, i.e. such that I can return false.

from yojimbo.

dbechrd avatar dbechrd commented on June 2, 2024

I was reading the code a bit more and just noticed this:

#if YOJIMBO_DEBUG_MESSAGE_BUDGET
            if ( channelConfig.packetBudget > 0 )
            {
                yojimbo_assert( stream.GetBitsProcessed() - startBits <= channelConfig.packetBudget * 8 );
            }
#endif // #if YOJIMBO_DEBUG_MESSAGE_BUDGET

But it doesn't run in my case since packetBudget is -1 by default.

I don't think @sherief 's commit is quite the correct, because they assert on availableBits, which can legitimately run out if you put enough messages into the packet. A better assert would be something akin to:

if (numMessageIds == 0) {
    // Increase your max packet size!
    yojimbo_assert( entry->measuredBits <= availableBits );
}

This assumes that yojimbo attempts to send the messages in the order they're submitted to the queue, such that the message that's too big will eventually make its way to the front of the queue and hit the assert. That seems like a reasonable assumption to me, but someone would have to sanity check it.

from yojimbo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.