[Twisted-Python] Connection close identifier

Tommi Virtanen tv at tv.debian.net
Thu Apr 8 03:45:39 EDT 2004

Itamar Shtull-Trauring wrote:
> Seems like a bad idea to me (like, if TCP connection doesn't close
> cleanly, do both sides think the other side closed? or what?). Better to
> indicate this information on protocol level.

It _should_ be easy to tell broken TCP connections from properly shut
down ones, as broken TCP connections end in errors. In twisted, this
means ConnectionDone implies clean shutdown, anything else an error.

BUT, transparent proxies quite commonly break this, and make errors in
the proxied connection look like clean shutdowns in the original
connection. Userspace proxies don't have a choice, even.

Another case where this breaks is server applications that exit
suddenly. File descriptors are cleanly closed at process exit.

All in all, I agree with Itamar, but with some reservations you can
do that by using a flag in protocol and comparing against

More information about the Twisted-Python mailing list