From ee80a210ffd37eab3b660be6f55fd161ea044ea1 Mon Sep 17 00:00:00 2001 From: MaleDong Date: Mon, 22 Apr 2019 09:41:33 +0800 Subject: [PATCH] dgram: change 'this' to 'self' for 'isConnected' The function 'isConnected' is directly called by many 'Socket' instance, so we shouldn't directly use 'this' because 'this' will be the self of function itself, and we should use 'self' as the instance of 'Socket' function. PR-URL: https://github.com/nodejs/node/pull/27338 Reviewed-By: Santiago Gimeno Reviewed-By: Joyee Cheung Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann Reviewed-By: Yongsheng Zhang Reviewed-By: Benjamin Gruenbaum --- lib/dgram.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dgram.js b/lib/dgram.js index 5a6d5aca2c3cf4..b38aa39c215aeb 100644 --- a/lib/dgram.js +++ b/lib/dgram.js @@ -519,7 +519,7 @@ function clearQueue() { function isConnected(self) { try { - this.remoteAddress(); + self.remoteAddress(); return true; } catch { return false;