Closed fomy closed 6 years ago
Hi, this block checks whether there is send buffer available.
sndbuf
is null, it means that there was no prior mtcp_write
call and we can create new send buffer in the future.If one of those two conditions is satisfied, mTCP raises an MTCP_EPOLLOUT
event so that the application can send. If sndvar->snd_wnd
is 0, I think the application shouldn't send anything.
Sure.
But your code is
sndvar->sndbuf->len < sndvar->snd_wnd
rather than
sndvar->snd_wnd > 0
Here is the code where snd_wnd is calculated:
sndvar->snd_wnd = sndvar->sndbuf->size - sndvar->sndbuf->len;
sndvar->snd_wnd indicates how many room available in the buf, and sndbuf->len indicates how many bytes are already in the buf.
sndvar->sndbuf->len < sndvar->snd_wnd will cause half of the buf cannot be used.
Now it makes sense! I was confused a little before you edited the comment.
I'll fix the condition to sndvar->snd_wnd > 0
. Thanks for reporting.
Hi,
I notice that only when sndvar->sndbuf->len < sndvar->snd_wnd, mtcp will raise an event. Should this condition be sndvar->snd_wnd > 0?
Thanks