Example #1
0
 def close(self):
     if hasattr(self, '_sid'):
         UniqueSessionIdManager.put(self._sid)
         delattr(self, '_sid')
     try:
         del self.server._Clients[id(self)]
     except:
         pass
     super().close()
	def close(self):
		if hasattr(self, '_sid'):
			UniqueSessionIdManager.put(self._sid)
			delattr(self, '_sid')
		try:
			del self.server._Clients[id(self)]
		except:
			pass
		super().close()
Example #3
0
 def _stratum_mining_subscribe(self, UA=None, xid=None):
     if not UA is None:
         self.UA = UA
     if not hasattr(self, "_sid"):
         self._sid = UniqueSessionIdManager.get()
     if self.server._Clients.get(self._sid) not in (self, None):
         del self._sid
         raise self.server.RaiseRedFlags(RuntimeError("issuing duplicate sessionid"))
     xid = struct.pack("=I", self._sid)  # NOTE: Assumes sessionids are 4 bytes
     self.extranonce1 = xid
     xid = b2a_hex(xid).decode("ascii")
     self.server._Clients[id(self)] = self
     self.changeTask(self.sendJob, 0)
     return [[["mining.notify", "%s1" % (xid,)], ["mining.set_difficulty", "%s2" % (xid,)]], xid, extranonce2sz]
	def _stratum_mining_subscribe(self, UA = None, xid = None):
		if not UA is None:
			self.UA = UA
		if not hasattr(self, '_sid'):
			self._sid = UniqueSessionIdManager.get()
		if self.server._Clients.get(self._sid) not in (self, None):
			del self._sid
			raise self.server.RaiseRedFlags(RuntimeError('issuing duplicate sessionid'))
		xid = struct.pack('=I', self._sid)  # NOTE: Assumes sessionids are 4 bytes
		self.extranonce1 = xid
		xid = b2a_hex(xid).decode('ascii')
		self.server._Clients[id(self)] = self
		self.changeTask(self.sendJob, 0)
		return [
			[
				['mining.notify', '%s1' % (xid,)],
				['mining.set_difficulty', '%s2' % (xid,)],
			],
			xid,
			4,
		]
Example #5
0
 def _stratum_mining_subscribe(self, UA=None, xid=None):
     if not UA is None:
         self.UA = UA
     if not hasattr(self, '_sid'):
         self._sid = UniqueSessionIdManager.get()
     if self.server._Clients.get(self._sid) not in (self, None):
         del self._sid
         raise self.server.RaiseRedFlags(
             RuntimeError('issuing duplicate sessionid'))
     xid = struct.pack('=I',
                       self._sid)  # NOTE: Assumes sessionids are 4 bytes
     self.extranonce1 = xid
     xid = b2a_hex(xid).decode('ascii')
     self.server._Clients[id(self)] = self
     self.changeTask(self.sendJob, 0)
     return [
         [
             ['mining.notify', '%s1' % (xid, )],
             ['mining.set_difficulty',
              '%s2' % (xid, )],
         ],
         xid,
         4,
     ]