def _run(self): self.io_loop = IOLoop() self.io_loop.make_current() self.tchannel = TChannel('proxy-server') # Hack around legacy TChannel from tchannel.thrift import rw as thriftrw thriftrw.register( self.tchannel._dep_tchannel._handler, proxy.VCRProxy, handler=self.send, ) self.tchannel.listen() self._running.set() self.io_loop.start()
def _run(self): self.io_loop = IOLoop() self.io_loop.make_current() self.tchannel = TChannel('proxy-server') # Hack around legacy TChannel from tchannel.thrift import rw as thriftrw thriftrw.register( self.tchannel._dep_tchannel._handler, proxy.VCRProxy, handler=self.send, ) try: self.tchannel.listen() self._running.set_result(None) except Exception: self._running.set_exception_info(*sys.exc_info()[1:]) else: self.io_loop.start()
def register(self, thrift_module, **kwargs): # dat circular import from tchannel.thrift import rw as thriftrw if isinstance(thrift_module, thriftrw.Service): # Dirty hack to support thriftrw and old API return thriftrw.register( # TODO drop deprecated tchannel self._tchannel._dep_tchannel._handler, thrift_module, **kwargs) else: return self._tchannel.register(scheme=self.NAME, endpoint=thrift_module, **kwargs)
def register(self, thrift_module, **kwargs): # dat circular import from tchannel.thrift import rw as thriftrw if isinstance(thrift_module, thriftrw.Service): # Dirty hack to support thriftrw and old API return thriftrw.register( # TODO drop deprecated tchannel self._tchannel._dep_tchannel._handler, thrift_module, **kwargs ) else: return self._tchannel.register( scheme=self.NAME, endpoint=thrift_module, **kwargs )