From 1f5e2310a6dc9b29f5525e2d6bcbd4c33cb1d693 Mon Sep 17 00:00:00 2001 From: Ian Scott Date: Mon, 16 May 2016 09:45:39 -0700 Subject: [PATCH] Fix remoteFamily on Node v0.10 --- lib/xcore.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/xcore.js b/lib/xcore.js index 519c665..cf073e4 100644 --- a/lib/xcore.js +++ b/lib/xcore.js @@ -39,7 +39,8 @@ XClient.prototype.init = function(stream) this.stream = stream; this.authHost = stream.remoteAddress; - this.authFamily = stream.remoteFamily; + // Node v0.10.x does not have stream.remoteFamily, so dig in to find it + this.authFamily = stream._getpeername ? stream._getpeername().family : stream.remoteFamily; if (!this.authHost || this.authHost === '127.0.0.1' || this.authHost === '::1') { this.authHost = os.hostname(); this.authFamily = null;