Exemple #1
0
 public override void Connect(IRpcController controller, ConnectRequest request, Action <ConnectResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
Exemple #2
0
 public override void Connect(IRpcController controller, ConnectRequest request, Action<ConnectResponse> done)
 {
     ProtoOutputBuffer.Write(request.GetType(), request.ToString());
 }
        public override void CallServerMethod(uint token, uint methodId, CodedInputStream stream)
        {
            switch (methodId)
            {
            case 1:
            {
                ConnectRequest  request  = ConnectRequest.Parser.ParseFrom(stream);
                ConnectResponse response = new ConnectResponse();

                BattlenetRpcErrorCode status = HandleConnect(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Connect(bgs.protocol.connection.v1.ConnectRequest: {1}) returned bgs.protocol.connection.v1.ConnectResponse: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 2:
            {
                BindRequest request = new BindRequest();
                request.MergeFrom(stream);

                BindResponse          response = new BindResponse();
                BattlenetRpcErrorCode status   = HandleBind(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Bind(bgs.protocol.connection.v1.BindRequest: {1}) returned bgs.protocol.connection.v1.BindResponse: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 3:
            {
                EchoRequest request = new EchoRequest();
                request.MergeFrom(stream);

                EchoResponse          response = new EchoResponse();
                BattlenetRpcErrorCode status   = HandleEcho(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Echo(bgs.protocol.connection.v1.EchoRequest: {1}) returned bgs.protocol.connection.v1.EchoResponse: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 4:
            {
                DisconnectNotification request = DisconnectNotification.Parser.ParseFrom(stream);

                BattlenetRpcErrorCode status = HandleForceDisconnect(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.ForceDisconnect(bgs.protocol.connection.v1.DisconnectNotification: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 5:
            {
                NoData request = NoData.Parser.ParseFrom(stream);

                BattlenetRpcErrorCode status = HandleKeepAlive(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.KeepAlive(bgs.protocol.NoData: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 6:
            {
                EncryptRequest request = EncryptRequest.Parser.ParseFrom(stream);

                NoData response = new NoData();
                BattlenetRpcErrorCode status = HandleEncrypt(request, response);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.Encrypt(bgs.protocol.connection.v1.EncryptRequest: {1}) returned bgs.protocol.NoData: {2} status: {3}.",
                             GetCallerInfo(), request.ToString(), response.ToString(), status);
                if (status == 0)
                {
                    SendResponse(token, response);
                }
                else
                {
                    SendResponse(token, status);
                }
                break;
            }

            case 7:
            {
                DisconnectRequest request = DisconnectRequest.Parser.ParseFrom(stream);

                BattlenetRpcErrorCode status = HandleRequestDisconnect(request);
                Log.outDebug(LogFilter.ServiceProtobuf, "{0} Client called server method ConnectionService.RequestDisconnect(bgs.protocol.connection.v1.DisconnectRequest: {1}) status: {2}.",
                             GetCallerInfo(), request.ToString(), status);
                if (status != 0)
                {
                    SendResponse(token, status);
                }
                break;
            }

            default:
                Log.outError(LogFilter.ServiceProtobuf, "Bad method id {0}.", methodId);
                SendResponse(token, BattlenetRpcErrorCode.RpcInvalidMethod);
                break;
            }
        }