TODO merge with SocketInitiatorThread
상속: IDisposable
예제 #1
0
        internal ClientHandlerThread(TcpClient tcpClient, long clientId, QuickFix.Dictionary settingsDict, SocketSettings socketSettings, AcceptorSocketDescriptor acceptorDescriptor
                                     )
        {
            string debugLogFilePath = "log";

            if (settingsDict.Has(SessionSettings.DEBUG_FILE_LOG_PATH))
            {
                debugLogFilePath = settingsDict.GetString(SessionSettings.DEBUG_FILE_LOG_PATH);
            }
            else if (settingsDict.Has(SessionSettings.FILE_LOG_PATH))
            {
                debugLogFilePath = settingsDict.GetString(SessionSettings.FILE_LOG_PATH);
            }

            var sessionId = new SessionID("ClientHandlerThread", clientId.ToString(), "Debug");

            try
            {
                // FIXME - do something more flexible than hardcoding a filelog
                log_ = new FileLog(debugLogFilePath, sessionId);
            }
            catch
            {
                // TODO: fix this the correct way
                log_ = new ScreenLog(sessionId, true, true, true);
            }

            this.Id       = clientId;
            socketReader_ = new SocketReader(tcpClient, socketSettings, this, acceptorDescriptor);
        }
예제 #2
0
 public ClientHandlerThread(TcpClient tcpClient, long clientId)
 {
     log_ = new FileLog("log", new SessionID("ClientHandlerThread", clientId.ToString(), "Debug")); /// FIXME
     tcpClient_ = tcpClient;
     id_ = clientId;
     socketReader_ = new SocketReader(tcpClient_, this);
 }
예제 #3
0
 public ClientHandlerThread(TcpClient tcpClient, long clientId)
 {
     log_          = new FileLog("log", new SessionID("ClientHandlerThread", clientId.ToString(), "Debug")); /// FIXME
     tcpClient_    = tcpClient;
     id_           = clientId;
     socketReader_ = new SocketReader(tcpClient_, this);
 }
예제 #4
0
        public void Dispose()
        {
            if (socketReader_ != null)
            {
                socketReader_.Dispose();
                socketReader_ = null;
            }

            if (log_ != null)
            {
                log_.Dispose();
                log_ = null;
            }
        }
예제 #5
0
        /// <summary>
        /// Creates a ClientHandlerThread
        /// </summary>
        /// <param name="tcpClient"></param>
        /// <param name="clientId"></param>
        /// <param name="debugLogFilePath">path where thread log will go</param>
        public ClientHandlerThread(TcpClient tcpClient, long clientId, QuickFix.Dictionary settingsDict, SocketSettings socketSettings)
        {
            string debugLogFilePath = "log";
            if (settingsDict.Has(SessionSettings.DEBUG_FILE_LOG_PATH))
                debugLogFilePath = settingsDict.GetString(SessionSettings.DEBUG_FILE_LOG_PATH);
            else if (settingsDict.Has(SessionSettings.FILE_LOG_PATH))
                debugLogFilePath = settingsDict.GetString(SessionSettings.FILE_LOG_PATH);

            // FIXME - do something more flexible than hardcoding a filelog
            log_ = new FileLog(debugLogFilePath, new SessionID("ClientHandlerThread", clientId.ToString(), "Debug"));

            this.Id = clientId;
            socketReader_ = new SocketReader(tcpClient, socketSettings, this);
        }
예제 #6
0
        /// <summary>
        /// Creates a ClientHandlerThread
        /// </summary>
        /// <param name="tcpClient"></param>
        /// <param name="clientId"></param>
        /// <param name="debugLogFilePath">path where thread log will go</param>
        public ClientHandlerThread(TcpClient tcpClient, long clientId, QuickFix.Dictionary settingsDict, SocketSettings socketSettings)
        {
            string debugLogFilePath = "log";

            if (settingsDict.Has(SessionSettings.DEBUG_FILE_LOG_PATH))
            {
                debugLogFilePath = settingsDict.GetString(SessionSettings.DEBUG_FILE_LOG_PATH);
            }
            else if (settingsDict.Has(SessionSettings.FILE_LOG_PATH))
            {
                debugLogFilePath = settingsDict.GetString(SessionSettings.FILE_LOG_PATH);
            }

            // FIXME - do something more flexible than hardcoding a filelog
            log_ = new FileLog(debugLogFilePath, new SessionID("ClientHandlerThread", clientId.ToString(), "Debug"));

            this.Id       = clientId;
            socketReader_ = new SocketReader(tcpClient, socketSettings, this);
        }
예제 #7
0
        internal ClientHandlerThread(TcpClient tcpClient, long clientId, QuickFix.Dictionary settingsDict,
                                     SocketSettings socketSettings, AcceptorSocketDescriptor acceptorDescriptor)
        {
            string debugLogFilePath = "";

            if (settingsDict.Has(SessionSettings.DEBUG_FILE_LOG_PATH))
            {
                debugLogFilePath = settingsDict.GetString(SessionSettings.DEBUG_FILE_LOG_PATH);
            }
            //else if (settingsDict.Has(SessionSettings.FILE_LOG_PATH))
            //    debugLogFilePath = settingsDict.GetString(SessionSettings.FILE_LOG_PATH);

            // FIXME - do something more flexible than hardcoding a filelog
            if (!string.IsNullOrEmpty(debugLogFilePath))
            {
                log_ = new FileLog(debugLogFilePath, new SessionID(
                                       "ClientHandlerThread", clientId.ToString(), "Debug-" + Guid.NewGuid().ToString()));
            }
            this.Id       = clientId;
            socketReader_ = new SocketReader(tcpClient, socketSettings, this, acceptorDescriptor);
        }
예제 #8
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }
            if (disposing)
            {
                if (socketReader_ != null)
                {
                    socketReader_.Dispose();
                    socketReader_ = null;
                }

                if (log_ != null)
                {
                    log_.Dispose();
                    log_ = null;
                }
            }
            _disposed = true;
        }
예제 #9
0
        internal ClientHandlerThread(TcpClient tcpClient, long clientId, QuickFix.Dictionary settingsDict,
                                     SocketSettings socketSettings, AcceptorSocketDescriptor acceptorDescriptor)
        {
            string debugLogFilePath = "log";

            if (settingsDict.Has(SessionSettings.DEBUG_FILE_LOG_PATH))
            {
                debugLogFilePath = settingsDict.GetString(SessionSettings.DEBUG_FILE_LOG_PATH);
            }
            else if (settingsDict.Has(SessionSettings.FILE_LOG_PATH))
            {
                debugLogFilePath = settingsDict.GetString(SessionSettings.FILE_LOG_PATH);
            }

            // FIXME - do something more flexible than hardcoding a filelog
            log_ = new FileLog(debugLogFilePath, new SessionID(
                                   "ClientHandlerThread", clientId.ToString(), "Debug-" + Guid.NewGuid().ToString()));

            this.Id            = clientId;
            this.SourceAddress = ((IPEndPoint)tcpClient.Client.RemoteEndPoint).Address.ToString();
            socketReader_      = new SocketReader(tcpClient, socketSettings, this, acceptorDescriptor);
        }
예제 #10
0
        public void Dispose()
        {
            if (socketReader_ != null)
            {
                socketReader_.Dispose();
                socketReader_ = null;
            }

            if (log_ != null)
            {
                log_.Dispose();
                log_ = null;
            }
        }