[
https://issues.apache.org/jira/browse/THRIFT-3787?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15240266#comment-15240266
]
ASF GitHub Bot commented on THRIFT-3787:
----------------------------------------
Github user jamesreggio commented on a diff in the pull request:
https://github.com/apache/thrift/pull/986#discussion_r59645250
--- Diff: lib/nodejs/lib/thrift/connection.js ---
@@ -81,15 +81,7 @@ var Connection = exports.Connection = function(stream,
options) {
});
this.connection.addListener("error", function(err) {
- // Only emit the error if no-one else is listening on the connection
- // or if someone is listening on us
- if (self.connection.listeners('error').length === 1 ||
- self.listeners('error').length > 0) {
- self.emit("error", err);
- }
- // "error" events get turned into exceptions if they aren't listened
for. If the user handled this error
- // then we should try to reconnect.
- self.connection_gone();
--- End diff --
Per [Node.js
documentation](https://nodejs.org/api/net.html#net_event_error_1), `error` is
always followed by `close`, so there's no need to call `connection_gone()`
twice.
> Node.js Connection object doesn't handle errors correctly
> ---------------------------------------------------------
>
> Key: THRIFT-3787
> URL: https://issues.apache.org/jira/browse/THRIFT-3787
> Project: Thrift
> Issue Type: Bug
> Components: Node.js - Library
> Reporter: James Reggio
> Priority: Minor
>
> There are a handful of operation-ordering problems in the
> Connection.prototype.connection_gone() method and its friends.
> See the pull request for more details.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)