Comparing version 1.2.2 to 1.2.3
@@ -155,6 +155,7 @@ var Errors = require('./errors'); | ||
}.bind(this)); | ||
this.socket.on('data', this.handleTransmissionError.bind(this)); | ||
this.socket.on("drain", this.socketDrained.bind(this)); | ||
this.socket.on("error", this.destroyConnection.bind(this)); | ||
this.socket.on('clientError', this.errorOccurred.bind(this)); | ||
this.socket.on("error", this.errorOccurred.bind(this)); | ||
this.socket.on("end", this.restartConnection.bind(this)); | ||
@@ -174,2 +175,16 @@ this.socket.once('close', this.restartConnection.bind(this)); | ||
*/ | ||
Connection.prototype.errorOccurred = function(err) { | ||
debug("Socket error occurred", err); | ||
if(!this.deferredConnection.promise.isResolved()) { | ||
this.deferredConnection.reject(err); | ||
} | ||
else { | ||
this.raiseError(err, null); | ||
} | ||
this.destroyConnection(); | ||
}; | ||
/** | ||
* @private | ||
*/ | ||
Connection.prototype.socketDrained = function() { | ||
@@ -294,3 +309,3 @@ debug("Socket drained"); | ||
Connection.prototype.raiseError = function(errorCode, notification) { | ||
debug("Raising error: %d", errorCode, notification); | ||
debug("Raising error:", errorCode, notification); | ||
if (typeof this.options.errorCallback == 'function') { | ||
@@ -374,5 +389,5 @@ this.options.errorCallback(errorCode, notification); | ||
this.raiseError(error, notification); | ||
}); | ||
}.bind(this)); | ||
}; | ||
module.exports = Connection; |
{ | ||
"name": "apn", | ||
"description": "An interface to the Apple Push Notification service for Node.js", | ||
"version": "1.2.2", | ||
"version": "1.2.3", | ||
"author": "Andrew Naylor <argon@mkbot.net>", | ||
@@ -6,0 +6,0 @@ "contributors": [ |
@@ -173,2 +173,11 @@ #node-apn | ||
1.2.3: | ||
* Added some more error handling to the connection methods. | ||
* Fixed a problem where an error handler was not bound to the correct context and wouldn't fire. | ||
1.2.2: | ||
* Fixes issue #47, Syntax Error in feedback.js | ||
1.2.1: | ||
@@ -175,0 +184,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42279
12
820
261