From 2d5dad362bb0f6220913b02cde211e59fcbf0086 Mon Sep 17 00:00:00 2001 From: Jacob Zuo Date: Mon, 18 Dec 2017 20:46:56 -0600 Subject: [PATCH] adding railguard to dispatch's event param --- lib/socket.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/socket.js b/lib/socket.js index 6c6bcde3e7..e14af7635f 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -503,8 +503,11 @@ Socket.prototype.compress = function(compress){ */ Socket.prototype.dispatch = function(event){ - debug('dispatching an event %j', event); + event = Array.isArray(event) ? event : [event]; var self = this; + + debug('dispatching an event %j', event); + function dispatchSocket(err) { process.nextTick(function(){ if (err) { @@ -513,6 +516,7 @@ Socket.prototype.dispatch = function(event){ emit.apply(self, event); }); } + this.run(event, dispatchSocket); };