Beispiel #1
0
        private void OnPingTimerCallback(object state)
        {
            IProtocolProcessor protocolProcessor = state as IProtocolProcessor;

            if (!string.IsNullOrEmpty(m_LastPingRequest) && !m_LastPingRequest.Equals(LastPongResponse))
            {
                try
                {
                    protocolProcessor.SendPong(this, "");
                }
                catch (Exception e)
                {
                    OnError(e);
                    return;
                }
            }
            m_LastPingRequest = DateTime.Now.ToString();
            try
            {
                protocolProcessor.SendPing(this, m_LastPingRequest);
            }
            catch (Exception e2)
            {
                OnError(e2);
            }
        }
Beispiel #2
0
 public virtual void Reset()
 {
     protocol = null;
     writerCount = 0;
     HighPriority = false;
     flags = (int) (ConnectionFlags.IsAlive | ConnectionFlags.CanRead);
 }
Beispiel #3
0
 public virtual void Reset()
 {
     protocol     = null;
     writerCount  = 0;
     HighPriority = false;
     flags        = (int)(ConnectionFlags.IsAlive | ConnectionFlags.CanRead);
 }
Beispiel #4
0
        public GatewayMiddleware(IServiceProvider provider, RequestDelegate next)
        {
            this._provider = provider;
            this._next     = next;

            this._processor = this._provider.GetRequiredService <IProtocolProcessor>();
        }
Beispiel #5
0
 public void SetProtocol(IProtocolProcessor protocol)
 {
     if (protocol == null)
     {
         throw new InvalidEnumArgumentException("protocol");
     }
     this.protocol = protocol;
 }
 public void Remove(RakPeerInterface recipient, IProtocolProcessor processor)
 {
     IDictionary<string, IProtocolProcessor> processors;
     if (processorsByRecipient.TryGetValue(recipient, out processors))
     {
         processors.Remove(processor.ProtocolName);
     }
 }
Beispiel #7
0
        // Token: 0x0600052A RID: 1322 RVA: 0x00005336 File Offset: 0x00003536
        private static IProtocolProcessor GetProtocolProcessor(WebSocketVersion version)
        {
            IProtocolProcessor processorByVersion = WebSocket.m_ProtocolProcessorFactory.GetProcessorByVersion(version);

            if (processorByVersion == null)
            {
                throw new ArgumentException("Invalid websocket version");
            }
            return(processorByVersion);
        }
Beispiel #8
0
        public bool GetAvailableProcessor(int[] availableVersions)
        {
            IProtocolProcessor preferedProcessorFromAvialable = m_ProtocolProcessorFactory.GetPreferedProcessorFromAvialable(availableVersions);

            if (preferedProcessorFromAvialable == null)
            {
                return(false);
            }
            ProtocolProcessor = preferedProcessorFromAvialable;
            return(true);
        }
Beispiel #9
0
        internal bool GetAvailableProcessor(int[] availableVersions)
        {
            IProtocolProcessor processorFromAvialable =
                WebSocket.m_ProtocolProcessorFactory.GetPreferedProcessorFromAvialable(availableVersions);

            if (processorFromAvialable == null)
            {
                return(false);
            }
            this.ProtocolProcessor = processorFromAvialable;
            return(true);
        }
 public void Add(RakPeerInterface recipient, IProtocolProcessor processor)
 {
     IDictionary<string, IProtocolProcessor> processors;
     if (processorsByRecipient.TryGetValue(recipient, out processors))
     {
         processors.Add(processor.ProtocolName, processor);
     }
     else
     {
         processors = new Dictionary<string, IProtocolProcessor>();
         processors.Add(processor.ProtocolName, processor);
         processorsByRecipient.Add(recipient, processors);
     }
 }
Beispiel #11
0
        private void OnPingTimerCallback(object state)
        {
            if (!string.IsNullOrEmpty(this.m_LastPingRequest) && !this.m_LastPingRequest.Equals(this.LastPongResponse))
            {
                return;
            }
            IProtocolProcessor protocolProcessor = state as IProtocolProcessor;

            this.m_LastPingRequest = DateTime.Now.ToString();
            try {
                protocolProcessor.SendPing(this, this.m_LastPingRequest);
            } catch (Exception ex) {
                this.OnError(ex);
            }
        }
Beispiel #12
0
        /// <summary>
        /// Handshakes the specified protocol processor.
        /// </summary>
        /// <param name="protocolProcessor">The protocol processor.</param>
        /// <param name="session">The session.</param>
        /// <returns></returns>
        protected bool Handshake(IProtocolProcessor protocolProcessor, IWebSocketSession session)
        {
            IReceiveFilter <IWebSocketFragment> dataFrameReader;

            if (!protocolProcessor.Handshake(session, this, out dataFrameReader))
            {
                session.Close(CloseReason.ServerClosing);
                return(false);
            }

            //Processor handshake sucessfully, but output datareader is null, so the multiple protocol switch handled the handshake
            //In this case, the handshake is not completed
            if (dataFrameReader == null)
            {
                NextReceiveFilter = this;
                return(false);
            }

            NextReceiveFilter = dataFrameReader;
            return(true);
        }
 public ClientPPLocator(EventHandlersOnClient handlers, IDOManager dOManager)
 {
     EventFactoryOnClient factory = new EventFactoryOnClient();
     ILogger logger = LightweightContainer.LogFactory.Create(typeof (ProtocolProcessor));
     processor = new ProtocolProcessor(ProtocolInfo.Instance.Name, factory, handlers, dOManager, logger);
 }
Beispiel #14
0
 public void SetProtocol(IProtocolProcessor protocol)
 {
     if (protocol == null) throw new InvalidEnumArgumentException("protocol");
     this.protocol = protocol;
 }
Beispiel #15
0
        public HackedRfc6455Processor(IProtocolProcessor baseObj)
        {
            m_baseProcessor = baseObj;

            m_webSocketClientProp = typeof(WebSocket).GetProperty("Client", BindingFlags.Instance | BindingFlags.ExactBinding | BindingFlags.GetProperty | BindingFlags.NonPublic);
        }
Beispiel #16
0
 public RpcBinder(RakPeerInterface recipient, IProcessorRegistry registry, IProtocolProcessor processor)
 {
     this.recipient = recipient;
     this.registry = registry;
     this.processor = processor;
 }