Resend a notification if error occurs during transmission
If the socket is "busy", i.e. hasn't drained, when an error occurs then we prepare the last notification to be resent. This should address issue #100. There's no way to stop the timeouts, but this should make the behaviour more consistent.
This commit is contained in:
Родитель
7d25b16026
Коммит
3fb447b2e5
|
@ -290,7 +290,7 @@ Connection.prototype.initialisingConnection = function() {
|
|||
*/
|
||||
Connection.prototype.errorOccurred = function(socket, err) {
|
||||
debug("Socket error occurred", socket.socketId, err);
|
||||
|
||||
|
||||
if(socket.transmissionErrorOccurred && err.code == 'EPIPE') {
|
||||
debug("EPIPE occurred after a transmission error which we can ignore");
|
||||
return;
|
||||
|
@ -303,6 +303,12 @@ Connection.prototype.errorOccurred = function(socket, err) {
|
|||
else {
|
||||
this.raiseError(err, null);
|
||||
}
|
||||
|
||||
if(socket.busy) {
|
||||
// A notification was in flight. It should be buffered for resending.
|
||||
this.bufferNotification(socket.cachedNotifications[socket.cachedNotifications.length - 1]);
|
||||
}
|
||||
|
||||
this.destroyConnection(socket);
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче