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 d78e88c

Browse files
committed
Fixed garbage protocols.
1 parent 0eb1494 commit d78e88c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public function __construct() {
1717
$c->on('data', function ($d, $c) use ($l) {
1818
$this->x($d, $c, $l);
1919
});
20-
$this->e('connected, total: '.($i+1).'.');
20+
$this->e($c->k.'connected, total: '.($i+1).'.');
2121
} else {
2222
$c->close();
2323
$this->e('ignored, too many.');
@@ -40,7 +40,7 @@ public function __construct() {
4040
private function x($__d, $c, $l) {
4141
foreach(explode(PHP_EOL, $c->u->d(trim($__d))) as $_d) {
4242
$this->e($c->k.' says: '.$_d);
43-
if (!($d = json_decode($_d, TRUE))) $this->k($l, $c, 'lost');
43+
if (!($d = json_decode($_d, TRUE))) { $this->k($l, $c, 'lost');break; }
4444
else if (isset($d['method'])) {
4545
if ($d['method'] == 'mining.subscribe') {
4646
$this->e($c->k.' gets subscription '.$d['id'].'.');
@@ -55,14 +55,14 @@ private function x($__d, $c, $l) {
5555
if (isset($d['params']) && isset($d['params'][0]) && $d['params'][0]) {
5656
$c->u->u = $d['params'][0];
5757
$this->c($l, $c);
58-
} else $this->k($l, $c, 'unkown');
58+
} else { $this->k($l, $c, 'unkown');break; }
5959
} else if ($c->p) {
6060
if(isset($d['method']) && $d['method']=='mining.submit' && isset($d['params']) && isset($d['params'][0]) and $d['params'][0]==$c->u->P['user'])
6161
$c->u->t(-$d['id']);
6262
$this->e('server '.$c->k.' gets '.$_d);
6363
$c->p->write($_d."\n");
6464
} else if (!isset($c->_p)) $this->c($l, $c);
65-
} else $this->k($l, $c, 'said garbage');
65+
} else { $this->k($l, $c, 'said garbage');break; }
6666
}
6767
}
6868

@@ -137,7 +137,7 @@ private function k($l, $c, $m) {
137137
$c->_p = -1;
138138
if ($c->p) $c->p->close();
139139
$c->close();
140-
unset($l->o[$k=$c->k], $c);
140+
unset($l->o[$k=$c->k]);
141141
$this->e($k.''.$m.', killed.');
142142
}
143143
}

0 commit comments

Comments
(0)

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