tessel / t1-runtime

[UNMAINTAINED] Tessel 1 JavaScript runtime.
Other
117 stars 33 forks source link

make http consume tcp errors properly #643

Closed jiahuang closed 10 years ago

jiahuang commented 10 years ago

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.

natevw commented 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.

natevw commented 10 years ago

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?

jendib commented 10 years ago

@natevw It's linked to https://forums.tessel.io/t/tessel-stops-running-after-15-minutes/859/56

natevw commented 10 years ago

lgtm now

tm-rampart commented 10 years ago

Approved by @jiahuang. Running tests.