Fix socket.io issue; fix ACP announcements
This commit is contained in:
parent
ec9ee1d37f
commit
9be993a679
|
@ -126,10 +126,10 @@ function addTypecheckedFunctions(sock) {
|
||||||
* Called after a connection is accepted
|
* Called after a connection is accepted
|
||||||
*/
|
*/
|
||||||
function handleConnection(sock) {
|
function handleConnection(sock) {
|
||||||
var ip = sock.request.connection.remoteAddress;
|
var ip = sock.client.conn.remoteAddress;
|
||||||
if (!ip) {
|
if (!ip) {
|
||||||
sock.emit("kick", {
|
sock.emit("kick", {
|
||||||
reason: "Your IP address could not be determined from the socket connection. See https://github.com/Automattic/socket.io/issues/1387#issuecomment-48425088 for details"
|
reason: "Your IP address could not be determined from the socket connection. See https://github.com/Automattic/socket.io/issues/1737 for details"
|
||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ var User = require("./user");
|
||||||
var $util = require("./utilities");
|
var $util = require("./utilities");
|
||||||
var db = require("./database");
|
var db = require("./database");
|
||||||
var Flags = require("./flags");
|
var Flags = require("./flags");
|
||||||
|
var sio = require("socket.io");
|
||||||
|
|
||||||
var Server = function () {
|
var Server = function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
@ -55,7 +56,6 @@ var Server = function () {
|
||||||
self.announcement = null;
|
self.announcement = null;
|
||||||
self.infogetter = null;
|
self.infogetter = null;
|
||||||
self.servers = {};
|
self.servers = {};
|
||||||
self.ioServers = {};
|
|
||||||
|
|
||||||
// database init ------------------------------------------------------
|
// database init ------------------------------------------------------
|
||||||
var Database = require("./database");
|
var Database = require("./database");
|
||||||
|
@ -207,9 +207,7 @@ Server.prototype.announce = function (data) {
|
||||||
} else {
|
} else {
|
||||||
this.announcement = data;
|
this.announcement = data;
|
||||||
db.setAnnouncement(data);
|
db.setAnnouncement(data);
|
||||||
for (var id in this.ioServers) {
|
sio.instance.emit("announcement", data);
|
||||||
this.ioServers[id].sockets.emit("announcement", data);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue