mirror of https://github.com/calzoneman/sync.git
Update socket.io to version 1.4.0
This commit is contained in:
parent
1ac69709ee
commit
eeaffe1f61
10
NEWS.md
10
NEWS.md
|
@ -1,3 +1,13 @@
|
||||||
|
2016-01-06
|
||||||
|
==========
|
||||||
|
|
||||||
|
This release updates socket.io to version 1.4.0. The updates to socket.io
|
||||||
|
include a few security-related fixes, so please be sure to run `npm install`
|
||||||
|
to ensure the updated version is installed before restarting your CyTube server.
|
||||||
|
|
||||||
|
* https://nodesecurity.io/advisories/67
|
||||||
|
* https://github.com/socketio/engine.io/commit/391ce0dc8b88a6609d88db83ea064040a05ab803
|
||||||
|
|
||||||
2015-10-25
|
2015-10-25
|
||||||
==========
|
==========
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,11 @@ io:
|
||||||
default-port: 1337
|
default-port: 1337
|
||||||
# limit the number of concurrent socket connections per IP address
|
# limit the number of concurrent socket connections per IP address
|
||||||
ip-connection-limit: 10
|
ip-connection-limit: 10
|
||||||
|
# Whether or not to use zlib to compress each socket message (this option is
|
||||||
|
# passed through to socket.io/engine.io).
|
||||||
|
# Note that while this may save a little bandwidth, it also consumes a lot
|
||||||
|
# more CPU and will bottleneck pretty quickly under heavy load.
|
||||||
|
per-message-deflate: false
|
||||||
|
|
||||||
# Mailer details (used for sending password reset links)
|
# Mailer details (used for sending password reset links)
|
||||||
# see https://github.com/andris9/Nodemailer
|
# see https://github.com/andris9/Nodemailer
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
"author": "Calvin Montgomery",
|
"author": "Calvin Montgomery",
|
||||||
"name": "CyTube",
|
"name": "CyTube",
|
||||||
"description": "Online media synchronizer and chat",
|
"description": "Online media synchronizer and chat",
|
||||||
"version": "3.12.1",
|
"version": "3.13.0",
|
||||||
"repository": {
|
"repository": {
|
||||||
"url": "http://github.com/calzoneman/sync"
|
"url": "http://github.com/calzoneman/sync"
|
||||||
},
|
},
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
"q": "^1.4.1",
|
"q": "^1.4.1",
|
||||||
"sanitize-html": "git://github.com/calzoneman/sanitize-html",
|
"sanitize-html": "git://github.com/calzoneman/sanitize-html",
|
||||||
"serve-static": "^1.10.0",
|
"serve-static": "^1.10.0",
|
||||||
"socket.io": "^1.3.7",
|
"socket.io": "^1.4.0",
|
||||||
"source-map-support": "^0.3.2",
|
"source-map-support": "^0.3.2",
|
||||||
"status-message-polyfill": "calzoneman/status-message-polyfill",
|
"status-message-polyfill": "calzoneman/status-message-polyfill",
|
||||||
"yamljs": "^0.1.6"
|
"yamljs": "^0.1.6"
|
||||||
|
|
|
@ -50,7 +50,8 @@ var defaults = {
|
||||||
io: {
|
io: {
|
||||||
domain: "http://localhost",
|
domain: "http://localhost",
|
||||||
"default-port": 1337,
|
"default-port": 1337,
|
||||||
"ip-connection-limit": 10
|
"ip-connection-limit": 10,
|
||||||
|
"per-message-deflate": false
|
||||||
},
|
},
|
||||||
mail: {
|
mail: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
|
|
@ -25,11 +25,20 @@ Socket.prototype.packet = function () {
|
||||||
exports.add('socket.io:packet');
|
exports.add('socket.io:packet');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function getConnectedSockets() {
|
||||||
|
var sockets = io.instance.sockets.sockets;
|
||||||
|
if (typeof sockets.length === 'number') {
|
||||||
|
return sockets.length;
|
||||||
|
} else {
|
||||||
|
return Object.keys(sockets).length;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
setInterval(function () {
|
setInterval(function () {
|
||||||
try {
|
try {
|
||||||
counters['memory:rss'] = process.memoryUsage().rss / 1048576;
|
counters['memory:rss'] = process.memoryUsage().rss / 1048576;
|
||||||
counters['load:1min'] = os.loadavg()[0];
|
counters['load:1min'] = os.loadavg()[0];
|
||||||
counters['socket.io:count'] = io.instance.sockets.sockets.length;
|
counters['socket.io:count'] = getConnectedSockets();
|
||||||
counterLog.log(JSON.stringify(counters));
|
counterLog.log(JSON.stringify(counters));
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Logger.errlog.log(e.stack);
|
Logger.errlog.log(e.stack);
|
||||||
|
|
|
@ -583,7 +583,7 @@ module.exports.loadAnnouncement = function () {
|
||||||
var sv = Server.getServer();
|
var sv = Server.getServer();
|
||||||
sv.announcement = announcement;
|
sv.announcement = announcement;
|
||||||
for (var id in sv.ioServers) {
|
for (var id in sv.ioServers) {
|
||||||
sv.ioServers[id].sockets.emit("announcement", announcement);
|
sv.ioServers[id].emit("announcement", announcement);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -242,6 +242,9 @@ function handleConnection(sock) {
|
||||||
module.exports = {
|
module.exports = {
|
||||||
init: function (srv, webConfig) {
|
init: function (srv, webConfig) {
|
||||||
var bound = {};
|
var bound = {};
|
||||||
|
const ioOptions = {
|
||||||
|
perMessageDeflate: Config.get("io.per-message-deflate")
|
||||||
|
};
|
||||||
var io = sio.instance = sio();
|
var io = sio.instance = sio();
|
||||||
|
|
||||||
io.use(handleAuth);
|
io.use(handleAuth);
|
||||||
|
@ -259,7 +262,7 @@ module.exports = {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (id in srv.servers) {
|
if (id in srv.servers) {
|
||||||
io.attach(srv.servers[id]);
|
io.attach(srv.servers[id], ioOptions);
|
||||||
} else {
|
} else {
|
||||||
var server = require("http").createServer().listen(bind.port, bind.ip);
|
var server = require("http").createServer().listen(bind.port, bind.ip);
|
||||||
server.on("clientError", function (err, socket) {
|
server.on("clientError", function (err, socket) {
|
||||||
|
@ -268,7 +271,7 @@ module.exports = {
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
io.attach(server);
|
io.attach(server, ioOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
bound[id] = null;
|
bound[id] = null;
|
||||||
|
|
Loading…
Reference in New Issue