Esempio n. 1
0
 private void StartXmlReaderOnSocket(Socket socket, string username, string sessionGuid)
 {
     _xmlMessageReader = new XmlMessageReader(socket, this);
     _xmlMessageReader.MessageReceived += OnMessageReceived;
     _xmlMessageReader.Start();
     Send(string.Format(CultureInfo.InvariantCulture, XmlRtlRouteMessage, SecurityElement.Escape(username), SecurityElement.Escape(sessionGuid)));
     Log.Information("Started real time list for {0}.", _username);
 }
Esempio n. 2
0
        void IDisposable.Dispose()
        {
            lock (_shutDownLock)
            {
                // Only shut down once
                if (!IsShutdownRequested)
                {
                    _shutDownRequested = true;
                    if (_xmlMessageReader != null)
                    {
                        _xmlMessageReader.MessageReceived -= OnMessageReceived;
                        _xmlMessageReader.Stop();
                        _xmlMessageReader = null;
                    }
                    
                    if (_socket != null)
                    {
                        if (_socket.Connected)
                        {
                            _socket.Shutdown(SocketShutdown.Both);
                        }

                        _socket.Close();
                        _socket = null;
                    }
                }
            }
        }