mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
Fixed distributed connections detection.
Fixed; make sure all heartbeats are captured. Changed; make sure to close on our end when the socket 'end'/'close' event fires.
This commit is contained in:
@@ -76,7 +76,7 @@ Transport.prototype.handleRequest = function (req) {
|
||||
|
||||
this.log.debug('publishing that', this.id, 'connected');
|
||||
this.store.publish('open:' + this.id, function () {
|
||||
self.store.once('open:' + this.id, function () {
|
||||
self.store.once('open:' + self.id, function () {
|
||||
self.log.debug('request for existing session connection change');
|
||||
self.close();
|
||||
self.clearTimeouts();
|
||||
@@ -94,7 +94,7 @@ Transport.prototype.handleRequest = function (req) {
|
||||
self.onForcedDisconnect();
|
||||
});
|
||||
|
||||
this.store.once('heartbeat-clear:' + this.id, function () {
|
||||
this.store.on('heartbeat-clear:' + this.id, function () {
|
||||
self.clearHeartbeatTimeout();
|
||||
self.setHeartbeatInterval();
|
||||
});
|
||||
@@ -103,6 +103,7 @@ Transport.prototype.handleRequest = function (req) {
|
||||
// add a handler only once per socket
|
||||
this.socket.setNoDelay(true);
|
||||
this.socket.on('end', this.onSocketEnd.bind(this));
|
||||
this.socket.on('close', this.onSocketEnd.bind(this));
|
||||
this.socket.on('error', this.onSocketError.bind(this));
|
||||
this.onSocketConnect();
|
||||
this.socket.__ioHandler = true;
|
||||
@@ -125,7 +126,7 @@ Transport.prototype.onSocketConnect = function () { };
|
||||
*/
|
||||
|
||||
Transport.prototype.onSocketEnd = function () {
|
||||
this.onClose();
|
||||
this.close();
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -434,7 +435,7 @@ Transport.prototype.subscribe = function () {
|
||||
self.payload(payload.map(function (packet) {
|
||||
return parser.encodePacket(packet);
|
||||
}));
|
||||
} else {
|
||||
} else {
|
||||
self.write(packet);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user