@@ -16,7 +16,8 @@ public function __construct() {
1616 $ this s [] = $ c
1717 $ this l ('connected, total:  ' .($ k1 ).'. ' );
1818 $ con ('close ' , function  ($ c
19-  $ this k (array_search ($ c$ this s ), 'gone ' );
19+  if  (($ karray_search ($ c$ this s ))!==FALSE )
20+  $ this k ($ k$ c'gone ' );
2021 });
2122 $ con ('data ' , function  ($ d$ cuse  ($ l
2223 $ this x ($ d$ c$ l
@@ -40,9 +41,13 @@ public function __construct() {
4041 }
4142
4243 private  function  x ($ _d$ _r$ l
43-  $ karray_search ($ _r$ this s );
44+  if  (($ karray_search ($ _r$ this s ))===FALSE ) {
45+  $ _rclose ();
46+  $ this l ('already kicked. ' );
47+  return ;
48+  }
4449 $ _d$ this o [$ kd ($ _d
45-  if  ($ _dFALSE  || !($ djson_decode ($ _dTRUE ))) $ this k ($ k'lost ' );
50+  if  ($ _dFALSE  || !($ djson_decode ($ _dTRUE ))) $ this k ($ k$ _r ,  'lost ' );
4651 else  {
4752 $ this l (((int )$ k' says:  ' .$ _d
4853 if  (isset ($ d'method ' ])) {
@@ -59,14 +64,14 @@ private function x($_d, $_r, $l) {
5964 if  (isset ($ d'params ' ]) && isset ($ d'params ' ][0 ]) && $ d'params ' ][0 ]) {
6065 $ this o [$ ku  = $ d'params ' ][0 ];
6166 $ this c ($ l$ k
62-  } else  $ this k ($ k'unkown ' );
67+  } else  $ this k ($ k$ _r ,  'unkown ' );
6368 } else  if  ($ this p [$ k
6469 if (isset ($ d'method ' ]) && $ d'method ' ]=='mining.submit '  && isset ($ d'params ' ]) && isset ($ d'params ' ][0 ]) and  $ d'params ' ][0 ]==$ this o [$ kP ['user ' ])
6570 $ this o [$ kt (-$ d'id ' ]);
6671 $ this l ('server  ' .$ k' gets  ' .$ _d
6772 $ this p [$ kwrite ($ _d
68-  } else  $ this k ($ k'lost server ' );
69-  } else  $ this k ($ k'said garbage ' );
73+  } else  $ this k ($ k$ _r ,  'lost server ' );
74+  } else  $ this k ($ k$ _r ,  'said garbage ' );
7075 }
7176 }
7277
@@ -86,13 +91,14 @@ private function c($l, $k, $o = 0) {
8691 $ this o [$ kI  = array ();
8792 $ this l (((int )$ k' connected to  ' .$ this o [$ kP ['url ' ].': ' .$ this o [$ kP ['port ' ].' as  ' .$ this o [$ kP ['user ' ].'. ' );
8893 $ son ('close ' , function  ($ s
89-  $ this k (array_search ($ s$ this p ), 'server gone ' );
94+  if  (($ karray_search ($ s$ this p ))!==FALSE )
95+  $ this k ($ k$ s'server gone ' );
9096 });
9197 $ son ('data ' , function  ($ __d$ s
9298 $ karray_search ($ s$ this p );
9399 if  (isset ($ this s [$ k
94100 foreach (array_filter (explode (PHP_EOL , $ __das  $ _d
95-  if  ($ _dFALSE  || !($ djson_decode ($ _dTRUE ))) $ this k ($ k'server lost ' );
101+  if  ($ _dFALSE  || !($ djson_decode ($ _dTRUE ))) $ this k ($ k$ s ,  'server lost ' );
96102 if  (isset ($ d'id ' ]) && $ d'id ' ] && $ d'id ' ] == $ this o [$ ks [0 ]) {
97103 if  (isset ($ d'result ' ]) && isset ($ d'result ' ][1 ]) && $ d'result ' ][1 ]) {
98104 $ this l (((int )$ k' gets extranonce [" ' .$ d'result ' ][1 ].'",  ' .$ d'result ' ][2 ].']. ' );
@@ -107,16 +113,20 @@ private function c($l, $k, $o = 0) {
107113 if  (isset ($ d'result ' ]) && $ d'result ' ]===TRUE  && isset ($ d'id ' ]) && $ d'id ' ])
108114 $ this o [$ kt ($ d'id ' ]);
109115 }
110-  } else  $ this k ($ k'lost before server ' );
116+  } else  $ this k ($ k$ s ,  'lost before server ' );
111117 });
112-  } else  $ this k ($ k'miss subscribe ' );
118+  } else  $ this k ($ k$ s ,  'miss subscribe ' );
113119 }, function () use  ($ k$ n
114120 if  ($ n$ this c ($ l$ k$ n
115-  else  $ this k ($ k'lost pools ' );
121+  else  $ this k ($ k$ this -> s [ $ k ],  'lost pools ' );
116122 });
117123 }
118124
119-  private  function  k ($ k$ m
125+  private  function  k ($ k$ x$ m
126+  if  ($ kFALSE  || !in_array ($ xarray ($ this s [$ k$ this p [$ kTRUE )) {
127+  $ this l (($ kFALSE ?'? ' :(int )$ k' does not compute. ' );
128+  return ;
129+  }
120130 unset($ this s [$ k$ this p [$ k$ this o [$ k
121131 $ this s  = array_values ($ this s );
122132 $ this p  = array_values ($ this p );
0 commit comments