#49 SimpleComm_SendQueue long message bug

closed
nobody
None
5
2007-07-31
2007-07-29
No

If SIMPLECOMM_CHARACTERSPERTICK_MAX is reduced to below 240, SimpleComm_SendQueue risks to cease sending messages (as soon as a message text longer than SIMPLECOMM_CHARACTERSPERTICK_MAX is sent).

This makes throttling GA below 240 chars/tick impossible or at least very unreliable.

I have fixed it this way:

I have defined a new variable in the same scope as SimpleComm_sentBytes called SimpleComm_extraBytes. Probably a bad name, but meh..

In the function I have added this line:

SimpleComm_extraBytes = SimpleComm_extraBytes + (SIMPLECOMM_CHARACTERSPERTICK_MAX - SimpleComm_sentBytes);

just before the "break;" line. Efter the "end" after the "break" I added this line:

SimpleComm_extraBytes=0;

I also changed this line:

SimpleComm_sentBytes = 0;

to:

SimpleComm_sentBytes = -SimpleComm_extraBytes;

Doing this make it possible to send long messages without exceeding the SIMPLECOMM_CHARACTERSPERTICK_MAX limit.

Characters are simply saved up until enough are in the "bag" and then the message is sent and the bag is emptied.

This is tested and found to be working. :-)

Discussion

  • Bernhard Ege

    Bernhard Ege - 2007-07-29

    Logged In: YES
    user_id=293001
    Originator: YES

    I changed my fix a bit as I think there was a bug. The new fix still uses the SimpleComm_extraBytes variable but the changed/added lines are these:

    In function SimpleComm_SendQueue these changes are to be made:

    Change:

    if SimpleComm_sentBytes > SIMPLECOMM_CHARACTERSPERTICK_MAX then

    to:

    if SimpleComm_sentBytes > (SIMPLECOMM_CHARACTERSPERTICK_MAX+SimpleComm_extraBytes) then

    Add this line just before "break;":

    SimpleComm_extraBytes = SimpleComm_extraBytes + (SIMPLECOMM_CHARACTERSPERTICK_MAX - SimpleComm_sentBytes);

    Add this line just after the "end" after "break;":

    SimpleComm_extraBytes = 0;

    That's it.

     
  • Bernhard Ege

    Bernhard Ege - 2007-07-31
    • status: open --> closed
     
  • Bernhard Ege

    Bernhard Ege - 2007-07-31

    Logged In: YES
    user_id=293001
    Originator: YES

    Fixed in rev 177.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks