]> rtime.felk.cvut.cz Git - frescor/fwp.git/commit
Fixed broken budgeting algorithm
authorMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 13 Aug 2009 15:29:34 +0000 (17:29 +0200)
committerMichal Sojka <sojkam1@fel.cvut.cz>
Thu, 13 Aug 2009 15:29:44 +0000 (17:29 +0200)
commitbc610379e0384557c69aefe64a3fed83999415b7
tree1a828e70676ed9e1505dc7cb8a539cfe93a77cd3
parent3501649ac0ec2d119b7016fce89637a7e59cfb76
Fixed broken budgeting algorithm

The problems of the previous implementation were:

1) Messages were almost always delayed event if it was not necessary.
   The reason was that the budget was replenished only at the
   multiples of period since the VRES thread started. Even if no
   message was sent for several periods, the budget was not
   replenished immediately when a new message arrived, but the code
   wait for the next period.
2) It was possible to send more bytes then the VRES should allow. If
   the message was too large, the code just wait for the new replenish
   and then sent the message. At the next replenish instant, the
   budget was fully replenished again another oversized message could
   be sent again.

The new algorithm should solve all the above points.
fwp/lib/fwp/fwp_vres.c