From 46d4920c7eeeab5973a994841694a4be720c882b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Geisendo=CC=88rfer?= Date: Tue, 19 Jul 2011 09:24:01 +0200 Subject: [PATCH] Make worker accessible to plugins Problem: There was previously no way to get a hold of the Worker instance inside a worker when writing a plugin. This patch provides such a reference by attaching the Worker instance to the Master instance inside a worker. --- lib/master.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/master.js b/lib/master.js index e4a4627..da58d8c 100644 --- a/lib/master.js +++ b/lib/master.js @@ -260,6 +260,7 @@ Master.prototype.start = function(fn){ if (this.isWorker) { // connect the worker var worker = new Worker(this); + this.worker = worker; this.sock = net.createConnection(this.socketPath); this.sock.on('connect', function(){ worker.start();