Example #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);
            }
        }
Example #2
0
 public virtual void Reset()
 {
     protocol = null;
     writerCount = 0;
     HighPriority = false;
     flags = (int) (ConnectionFlags.IsAlive | ConnectionFlags.CanRead);
 }
Example #3
0
 public virtual void Reset()
 {
     protocol     = null;
     writerCount  = 0;
     HighPriority = false;
     flags        = (int)(ConnectionFlags.IsAlive | ConnectionFlags.CanRead);
 }
Example #4
0
        public GatewayMiddleware(IServiceProvider provider, RequestDelegate next)
        {
            this._provider = provider;
            this._next     = next;

            this._processor = this._provider.GetRequiredService <IProtocolProcessor>();
        }
Example #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);
     }
 }
Example #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);
        }
Example #8
0
        public bool GetAvailableProcessor(int[] availableVersions)
        {
            IProtocolProcessor preferedProcessorFromAvialable = m_ProtocolProcessorFactory.GetPreferedProcessorFromAvialable(availableVersions);

            if (preferedProcessorFromAvialable == null)
            {
                return(false);
            }
            ProtocolProcessor = preferedProcessorFromAvialable;
            return(true);
        }
Example #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);
     }
 }
Example #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);
            }
        }
Example #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);
        }
Example #13
0
 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);
 }
Example #14
0
 public void SetProtocol(IProtocolProcessor protocol)
 {
     if (protocol == null) throw new InvalidEnumArgumentException("protocol");
     this.protocol = protocol;
 }
Example #15
0
        public HackedRfc6455Processor(IProtocolProcessor baseObj)
        {
            m_baseProcessor = baseObj;

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