Page MenuHomeFreeBSD

tcp: Shouldn't drain empty sbuf

Authored by rscheff on Mar 31 2021, 11:01 PM.

Diff Detail

R10 FreeBSD src repository
Automatic diff as part of commit; lint not applicable.
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

  • fix typo in assert string

Maybe add a comment why you are doing this dance. It wasn't obvious for us...

  • add comment to explain why do_drain is needed

Not sure coordination is involved. Isn't it more that one should not call sbuf_drain() with an empty buffer. Please state that and finish the sentence with a full stop (.).

This revision is now accepted and ready to land.Apr 1 2021, 2:40 PM
This revision was automatically updated to reflect the committed changes.

I would probably instead have changed sbuf_drain() to just return instead of asserting. Asserting made sense when it was a private implementation function, as a public API I think just returning instead of asserting is better behavior.