mirror of
https://github.com/socketio/socket.io.git
synced 2026-04-30 03:00:39 -04:00
server: fix ws memory leak (fixes #268)
This commit is contained in:
@@ -49,7 +49,7 @@ function Server(opts){
|
||||
if (~this.transports.indexOf('websocket')) {
|
||||
this.ws = new WebSocketServer({ noServer: true, clientTracking: false });
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Protocol errors mappings.
|
||||
@@ -268,7 +268,7 @@ Server.prototype.handshake = function(transport, req){
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Server.prototype.handleUpgrade = function(req, socket, head){
|
||||
Server.prototype.handleUpgrade = function(req, socket, upgradeHead){
|
||||
this.prepare(req);
|
||||
|
||||
var self = this;
|
||||
@@ -278,8 +278,12 @@ Server.prototype.handleUpgrade = function(req, socket, head){
|
||||
return;
|
||||
}
|
||||
|
||||
var head = new Buffer(upgradeHead.length);
|
||||
upgradeHead.copy(head);
|
||||
upgradeHead = null;
|
||||
|
||||
// delegate to ws
|
||||
self.ws.handleUpgrade(req, socket, head, function(conn){
|
||||
self.ws.handleUpgrade(req, socket, upgradeHead, function(conn){
|
||||
self.onWebSocket(req, conn);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user