wangshen2014 / pywebsocket

Automatically exported from code.google.com/p/pywebsocket
0 stars 0 forks source link

Drain unread data in receive buffer before closing socket not to send out TCP RST packet #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Since when deflate-stream extension is enabled, DEFLATE compressor adds some
empty DEFLATE block to flush data to octet boundary, some data may left in
receive buffer even after seeing a close frame. If we close a socket without
draining this data, TCP may send out TCP RST packet to the other peer to
prevent it from receive data correctly.

This CL tries to drain unread data by using non-blocking read. Because mp_conn
of mod_python doesn't provide non-blocking read, we only perform this in
standalone mode.

Thanks Patrick of Mozilla for bug report and basic idea for fixing it.

Original issue reported on code.google.com by tyoshino@chromium.org on 7 Jul 2011 at 5:02

GoogleCodeExporter commented 9 years ago
Fixed http://codereview.appspot.com/4643069/

Original comment by tyoshino@chromium.org on 7 Jul 2011 at 5:03

GoogleCodeExporter commented 9 years ago

Original comment by tyoshino@chromium.org on 7 Jul 2011 at 5:03