lidgren / lidgren-network-gen3

Lidgren Network Library
https://groups.google.com/forum/#!forum/lidgren-network-gen3
MIT License
1.19k stars 331 forks source link

NullRefenceException during DestoreMessage() call #76

Closed aienabled closed 8 years ago

aienabled commented 8 years ago

Hello!

I've noticed a lot of exception related to DestoreMessage() call:

private void DestoreMessage(double now, int storeIndex, out bool resetTimeout)
        {
            // reset timeout if we receive ack within kThreshold of sending it
            const double kThreshold = 2.0;
            var srm = m_storedMessages[storeIndex];
            resetTimeout = (srm.NumSent == 1) && (now - srm.LastSent < kThreshold);

            var storedMessage = srm.Message;

            // on each destore; reduce recyclingcount so that when all instances are destored, the outgoing message can be recycled
            Interlocked.Decrement(ref storedMessage.m_recyclingCount);

In my case storedMessage is null.

The problem appeared a few month ago (after I pulled latest commits). Currently I'm using latest version - and exception happens very often when the network clients suddenly disconnects from the server.

Regards!

aienabled commented 8 years ago

Sorry for the false report. It seems to be a bad merge with some of my changes and latest commits.