mirror of
https://github.com/socketio/socket.io.git
synced 2026-01-11 16:08:24 -05:00
Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a4e53a642b | ||
|
|
6f36d8c2ff | ||
|
|
09fb16b443 | ||
|
|
330407cc9d | ||
|
|
2075307f23 | ||
|
|
d7b06edaca |
@@ -1,4 +1,13 @@
|
||||
|
||||
0.9.5 / 2012-04-05
|
||||
==================
|
||||
|
||||
* Added test for polling and socket close.
|
||||
* Ensure close upon request close.
|
||||
* Fix disconnection reason being lost for polling transports.
|
||||
* Ensure that polling transports work with Connection: close.
|
||||
* Log disconnection reason.
|
||||
|
||||
0.9.4 / 2012-04-01
|
||||
==================
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ var client = require('socket.io-client');
|
||||
* Version.
|
||||
*/
|
||||
|
||||
exports.version = '0.9.4';
|
||||
exports.version = '0.9.5';
|
||||
|
||||
/**
|
||||
* Supported protocol version.
|
||||
|
||||
@@ -455,7 +455,7 @@ Transport.prototype.onClose = function () {
|
||||
|
||||
Transport.prototype.end = function (reason) {
|
||||
if (!this.disconnected) {
|
||||
this.log.info('transport end');
|
||||
this.log.info('transport end (' + reason + ')');
|
||||
|
||||
var local = this.manager.transports[this.id];
|
||||
|
||||
|
||||
@@ -43,6 +43,18 @@ HTTPPolling.prototype.__proto__ = HTTPTransport.prototype;
|
||||
|
||||
HTTPPolling.prototype.name = 'httppolling';
|
||||
|
||||
/**
|
||||
* Override setHandlers
|
||||
*
|
||||
* @api private
|
||||
*/
|
||||
|
||||
HTTPPolling.prototype.setHandlers = function () {
|
||||
HTTPTransport.prototype.setHandlers.call(this);
|
||||
this.socket.removeListener('end', this.bound.end);
|
||||
this.socket.removeListener('close', this.bound.close);
|
||||
};
|
||||
|
||||
/**
|
||||
* Removes heartbeat timeouts for polling.
|
||||
*/
|
||||
@@ -128,8 +140,8 @@ HTTPPolling.prototype.write = function (data, close) {
|
||||
* @api private
|
||||
*/
|
||||
|
||||
HTTPPolling.prototype.end = function () {
|
||||
HTTPPolling.prototype.end = function (reason) {
|
||||
this.clearPollTimeout();
|
||||
return HTTPTransport.prototype.end.call(this);
|
||||
return HTTPTransport.prototype.end.call(this, reason);
|
||||
};
|
||||
|
||||
|
||||
@@ -68,6 +68,7 @@ HTTPTransport.prototype.handleRequest = function (req) {
|
||||
// prevent memory leaks for uncompleted requests
|
||||
req.on('close', function () {
|
||||
buffer = '';
|
||||
self.onClose();
|
||||
});
|
||||
|
||||
if (origin) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "socket.io"
|
||||
, "version": "0.9.4"
|
||||
, "version": "0.9.5"
|
||||
, "description": "Real-time apps made cross-browser & easy with a WebSocket-like API"
|
||||
, "homepage": "http://socket.io"
|
||||
, "keywords": ["websocket", "socket", "realtime", "socket.io", "comet", "ajax"]
|
||||
@@ -16,7 +16,7 @@
|
||||
, "url": "https://github.com/LearnBoost/socket.io.git"
|
||||
}
|
||||
, "dependencies": {
|
||||
"socket.io-client": "0.9.4"
|
||||
"socket.io-client": "0.9.5"
|
||||
, "policyfile": "0.0.4"
|
||||
, "redis": "0.6.7"
|
||||
}
|
||||
|
||||
@@ -289,6 +289,40 @@ module.exports = {
|
||||
});
|
||||
},
|
||||
|
||||
'test that connection close does not mean disconnect': function (done) {
|
||||
var cl = client(++ports)
|
||||
, io = create(cl)
|
||||
, sid
|
||||
, end
|
||||
, disconnected = false
|
||||
|
||||
io.configure(function () {
|
||||
io.set('polling duration', .2);
|
||||
io.set('close timeout', .5);
|
||||
});
|
||||
|
||||
io.sockets.on('connection', function (client) {
|
||||
end = function () {
|
||||
cl.end();
|
||||
console.log('ending');
|
||||
client.on('disconnect', function () {
|
||||
disconnected = true;
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
cl.handshake(function (sid) {
|
||||
cl.get('/socket.io/{protocol}/xhr-polling/' + sid);
|
||||
setTimeout(end, 30);
|
||||
setTimeout(function () {
|
||||
console.log('finished');
|
||||
disconnected.should.be.false;
|
||||
io.server.close();
|
||||
done();
|
||||
}, 100);
|
||||
});
|
||||
},
|
||||
|
||||
'test sending back data': function (done) {
|
||||
var cl = client(++ports)
|
||||
, io = create(cl);
|
||||
|
||||
Reference in New Issue
Block a user