Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d93e3cb

Browse files
committed
Fixed useless var.
1 parent 379b25c commit d93e3cb

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

‎bin/php-proxy-stratum-daemon.php‎

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ public function __construct() {
99
$s = new React\Socket\Server($l);
1010
$s->on('connection', function ($c) use ($l) {
1111
if (($o = count($this->o))<9999) {
12-
$c->l = $l;
1312
$c->p = NULL;
1413
$c->u = new U();
1514
$this->o[$c->k=(int)$c->stream] = $c;
1615
$c->on('close', function ($c) {
1716
$this->k($c->k, $c, 'gone');
1817
});
19-
$c->on('data', function ($d, $c) {
20-
$this->x($d, $c);
18+
$c->on('data', function ($d, $c) use ($l) {
19+
$this->x($d, $c, $l);
2120
});
2221
$this->l('connected, total: '.($o+1).'.');
2322
} else {
@@ -28,10 +27,9 @@ public function __construct() {
2827
$s->listen(3333, 0);
2928
$w = new React\Socket\Server($l);
3029
$w->on('connection', function ($c) use ($l) {
31-
$c->l = $l;
32-
$c->on('data', function ($d, $c) {
30+
$c->on('data', function ($d, $c) use ($l) {
3331
if ($c->getRemoteAddress()=='127.0.0.1')
34-
$this->h($d, $c);
32+
$this->h($d, $c, $l);
3533
$c->end();
3634
});
3735
});
@@ -40,7 +38,7 @@ public function __construct() {
4038
$l->run();
4139
}
4240

43-
private function x($_d, $c) {
41+
private function x($_d, $c, $l) {
4442
$_d = $c->u->d($_d);
4543
if ($_d === FALSE || !($d = json_decode($_d, TRUE))) $this->k($c->k, $c, 'lost');
4644
else {
@@ -58,7 +56,7 @@ private function x($_d, $c) {
5856
$c->write('{"error":null,"id":'.$d['id'].',"result":true}'."\n");
5957
if (isset($d['params']) && isset($d['params'][0]) && $d['params'][0]) {
6058
$c->u->u = $d['params'][0];
61-
$this->c($c);
59+
$this->c($l, $c);
6260
} else $this->k($c->k, $c, 'unkown');
6361
} else if ($c->p) {
6462
if(isset($d['method']) && $d['method']=='mining.submit' && isset($d['params']) && isset($d['params'][0]) and $d['params'][0]==$c->u->P['user'])
@@ -70,14 +68,14 @@ private function x($_d, $c) {
7068
}
7169
}
7270

73-
private function c($c, $o = 0) {
71+
private function c($l, $c, $o = 0) {
7472
if ($c->p) $c->p->end();
7573
$c->p = NULL;
7674
$a = $c->u->c();
7775
$c->u->P = $a[$o];
7876
$n = isset($a[$o+1]) ? $o+1 : 0;
7977
$x = new React\Dns\Resolver\Factory();
80-
$_c = new React\SocketClient\Connector($c->l, $x->createCached('8.8.8.8', $c->l));
78+
$_c = new React\SocketClient\Connector($l, $x->createCached('8.8.8.8', $l));
8179
$_c->create($c->u->P['url'], $c->u->P['port'])->then(function ($s) use ($c) {
8280
$c->p = $s;
8381
if ($c->u->s) {
@@ -109,8 +107,8 @@ private function c($c, $o = 0) {
109107
} else $this->k($c->k, $c, 'lost before server');
110108
});
111109
} else $this->k($c->k, $c, 'miss subscribe');
112-
}, function() use ($c, $n) {
113-
if ($n) $this->c($c, $n);
110+
}, function() use ($l, $c, $n) {
111+
if ($n) $this->c($l, $c, $n);
114112
else $this->k($c->k, $c, 'lost pools');
115113
});
116114
}
@@ -126,7 +124,7 @@ private function k($k, $c, $m) {
126124
}
127125
}
128126

129-
private function h($d, $c) {
127+
private function h($d, $c, $l) {
130128
$r = array('result'=>NULL);
131129
if (($d = json_decode($d, TRUE)) && isset($d['method']))
132130
switch($d['method']) {
@@ -151,7 +149,7 @@ private function h($d, $c) {
151149
case 'switchpool':
152150
foreach($this->o as $o) {
153151
if (is_null($o->u->u) || $o->u->u!=$d['params'][0]) continue;
154-
$this->c($o, $d['params'][1]);
152+
$this->c($l, $o, $d['params'][1]);
155153
}
156154
break;
157155
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /