Guest User

tesds

a guest
Jul 13th, 2017
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1.  
  2. from 138 to 177
  3.  
  4. else:
  5. log.error("Given extranonce is not registered1")
  6. return result
  7.  
  8. @defer.inlineCallbacks
  9. def login(self, params, *args):
  10. if self._f.client == None or not self._f.client.connected:
  11. yield self._f.on_connect
  12.  
  13. if self._f.client == None or not self._f.client.connected:
  14. raise UpstreamServiceException("Upstream not connected")
  15.  
  16. tail = self._get_unused_tail()
  17.  
  18. session = self.connection_ref().get_session()
  19. session['tail'] = tail
  20.  
  21. custom_user = self.custom_user
  22. custom_password = self.custom_password
  23. if self.enable_worker_id and params.has_key("login"):
  24. if self.worker_id_from_ip:
  25. ip_login = self.connection_ref()._get_ip()
  26. ip_temp = ip_login.split('.')
  27. ip_int = int(ip_temp[0])*16777216 + int(ip_temp[1])*65536 + int(ip_temp[2])*256 + int(ip_temp[3])
  28. custom_user = "%s.%s" % (custom_user, ip_int)
  29. else:
  30. params_login = re.sub(r'[^\w]', '', params["login"])
  31. if params_login and int(params_login)>0:
  32. #custom_user = "%s.%s" % (custom_user, params_login)
  33. custom_password = "%s:%s" % (params_login, custom_password)
  34.  
  35. first_job = (yield self._f.rpc('login', {"login":custom_user, "pass":self.custom_password}))
  36.  
  37. try:
  38. self.connection_ref().on_disconnect.addCallback(self._drop_tail, tail)
  39. except Exception:
  40. pass
  41. subs = Pubsub.subscribe(self.connection_ref(), MiningSubscription())[0]
  42.  
  43. MiningSubscription.add_user_id(subs[2], first_job['id'])
Add Comment
Please, Sign In to add comment