Closed jiahuang closed 10 years ago
Is this to fix a specific issue that has come up?
Tentative r- but will have to consider and review the situation more thoroughly. The thing to keep in mind is that a socket may be owned by multiple HTTP incoming/outgoing messages throughout its lifetime, due to keep-alive. IIRC the Agent should be handling close/error events while a socket is idle, so I'm not sure what you are trying to accomplish by this.
Oh, I think I did just get what you are saying — the issue if one were filed, is that sometimes when you close a socket it then emits an error, which would then crash the script since it is unhandled?
If that is the case, wouldn't a better fix be to have the socket avoid emitting any errors once it no longer makes sense to do so?
@natevw It's linked to https://forums.tessel.io/t/tessel-stops-running-after-15-minutes/859/56
lgtm now
Approved by @jiahuang. Running tests.
Sometimes the CC3k can't close its socket and throws an error. Http's
_unplug
was removing the error event listener once the message was parsed, but before the TCP socket was actually closed.