def OnTimer(timerid): Logger.LogDebug("Py OnTimer:%d" % timerid) from common import Timer Timer.onTimer(timerid) return 0, "success"
def OnClientProxy(sockfd, type, data, serverobj): """收到客户端的socket请求入口""" print("OnClientProxy:%d,%d,%s" % (sockfd, type, data)) if type == FD_TYPE_ACCEPT: logger.debug('OnClientProxy,type=FD_TYPE_ACCEPT,sock=%d' % sockfd) try: serverobj.add_client_rpc_channel(sockfd) except Exception as e: print("Exception:", e) elif type == FD_TYPE_CLIENT: logger.debug('OnClientProxy,type=FD_TYPE_READ,sock=%s' % sockfd) try: serverobj.handle_client_rpc_channel(sockfd, data) except Exception as e: print("Exception:", e) elif type == FD_TYPE_CLOSE: logger.debug('OnClientProxy,type=FD_TYPE_CLOSE,sock=%s' % sockfd) try: serverobj.del_client_rpc_channel(sockfd) except Exception as e: print("Exception:", e) elif type == FD_TYPE_TIMER: logger.debug('OnClientProxy,type=FD_TYPE_TIMER,sock=%s' % sockfd) from common import Timer Timer.onTimer(sockfd) # timerId