class RPCServer(object): def __init__(self, addr, port, user=None): self.dpmserver = DPMServer() self.addr = addr self.port = port self.user = user def run(self): self.dpmserver.run(self) def __proc(self, op, args, kwargs): res = '' func = getattr(self, op) if func: ret = func(*args, **kwargs) if ret: res = ret return dumps({'res': res}) def proc(self, buf): try: op, args, kwargs = unpack(buf) return self.__proc(op, args, kwargs) except: show_error(self, 'failed to process')
class RPCServer(object): def __init__(self, addr, port, user=None): self.dpmserver = DPMServer() self.addr = addr self.port = port self.user = user def run(self): self.dpmserver.run(self) def __proc(self, op, args, kwargs): res = '' func = getattr(self, op) if func: ret = func(*args, **kwargs) if ret: res = ret return dumps({'res':res}) def proc(self, buf): try: op, args, kwargs = unpack(buf) return self.__proc(op, args, kwargs) except: show_error(self, 'failed to process')
class RPCServer(object): def __init__(self, addr, port): self.addr = addr self.port = port self.dpmserver = DPMServer() def run(self): self.dpmserver.run(self) def __proc(self, op, args, kwargs): res = '' func = getattr(self, op) if func: ret = func(*args, **kwargs) if ret: #log_debug('RPCServer._proc', 'the return of func is : %s' % str(ret)) res = ret return bson.dumps({'res': res}) def proc(self, buf): op, args, kwargs = unpack(buf) return self.__proc(op, args, kwargs)
class RPCServer(object): def __init__(self, addr, port): self.addr = addr self.port = port self.dpmserver = DPMServer() def run(self): self.dpmserver.run(self) def __proc(self, op, args, kwargs): res = '' func = getattr(self, op) if func: ret = func(*args,**kwargs) if ret: #log_debug('RPCServer._proc', 'the return of func is : %s' % str(ret)) res = ret return bson.dumps({'res':res}) def proc(self, buf): op, args, kwargs = unpack(buf) return self.__proc(op, args, kwargs)