Beispiel #1
0
        public _RPCRetHandler(_NetRPCComponent rpcComponent
                              , NetRPCCall message
                              , long timeoutTime
                              , Action <_NetRPCReturn, Exception> callback)
        {
            _netRPCComponent = rpcComponent;
            _CallMessage     = message;
            _bIsDone         = false;

            _timer = TimerMgr.AddTimer();
            _timer.Handler(_onTimeout);
            _timer.Interval(timeoutTime).Start();

            _OnCallback = callback;
            _error      = null;
        }
Beispiel #2
0
        protected void _doNetCall(short type, object param, Action <_NetRPCReturn, Exception> callback)
        {
            ISerializableData data = null;

            if (param is ISerializableData)
            {
                data = (ISerializableData)param;
            }
            else
            {
                data = new PojoObject(param);
            }

            NetRPCCall netRPCCall = new NetRPCCall(type, data);

            if (_netRPCComponent == null)
            {
                _netRPCComponent = new _NetRPCComponent(this);
            }
            _netRPCComponent.Call(netRPCCall, callback, DEFAULT_RPC_TIMEOUT);
        }
Beispiel #3
0
        public Connection()
        {
            _netRPCComponent = new _NetRPCComponent(this);

            _socket         = new Socket();
            _socket.OnData += _onData;

            _messageDispatcher = new EventDispatcher <short, NetMessage>();

            _socket.OnDisconnected += err =>
            {
                _onFatalError(err);
            };

            __sysMsgQueue = new QuickList <_InternalMsg>();

/*
 *          AddNotifyListener((ushort)ServerSysMsgType.HANDSHAKE_TIMEOUT, msg =>
 *          {
 *              if (OnTimeout != null) OnTimeout(TimeoutType.Handshake, 0);
 *          });
 */
        }