diff --git a/src/meta/blacklist.js b/src/meta/blacklist.js index c441c71b95..479d2158a2 100644 --- a/src/meta/blacklist.js +++ b/src/meta/blacklist.js @@ -65,6 +65,9 @@ Blacklist.test = function (clientIp, callback) { // clientIp = '2001:db8:85a3:0:0:8a2e:370:7334'; // IPv6 // clientIp = '127.0.15.1'; // IPv4 // clientIp = '127.0.15.1:3443'; // IPv4 with port strip port to not fail + if (!clientIp) { + return setImmediate(callback); + } clientIp = clientIp.split(':').length === 2 ? clientIp.split(':')[0] : clientIp; var addr; diff --git a/src/socket.io/posts.js b/src/socket.io/posts.js index 108a29d136..b8c4695c69 100644 --- a/src/socket.io/posts.js +++ b/src/socket.io/posts.js @@ -32,6 +32,9 @@ SocketPosts.reply = function (socket, data, callback) { data.timestamp = Date.now(); async.waterfall([ + function (next) { + meta.blacklist.test(data.req.ip, next); + }, function (next) { posts.shouldQueue(socket.uid, data, next); }, diff --git a/src/socket.io/topics.js b/src/socket.io/topics.js index a7aa7a3ab0..89fca006c5 100644 --- a/src/socket.io/topics.js +++ b/src/socket.io/topics.js @@ -6,6 +6,7 @@ var topics = require('../topics'); var posts = require('../posts'); var websockets = require('./index'); var user = require('../user'); +var meta = require('../meta'); var apiController = require('../controllers/api'); var socketHelpers = require('./helpers'); @@ -28,6 +29,9 @@ SocketTopics.post = function (socket, data, callback) { data.timestamp = Date.now(); async.waterfall([ + function (next) { + meta.blacklist.test(data.req.ip, next); + }, function (next) { posts.shouldQueue(socket.uid, data, next); },