Example #1
0
        Session(string ip, int port, string authmethod, ProcessSessionErrorDelegate processError_, ProcessAnswerDelegate processAnswer_)
        {
            m_banner = null;
            m_connection = new Connection(ip, port, ProcessConnectionErrorDelegate, ProcessConnectionMessageDelegate);
            m_authmethod = authmethod;
            m_state = State.Init;

            m_processError = processError_;
            m_processAnswer = processAnswer_;

            m_requestqueue = new Queue<Request>();
            m_request = null;
            m_answerbuf = null;
        }
Example #2
0
        /* PUBLIC METHODS: */
        public Session( Configuration config_, AnswerCallback answerCallback_)
        {
            m_config = config_;
            m_serializer = new Serializer(m_config.schemadir, m_config.schemaext);
            m_connection = new Connection( m_config);

            m_lasterror = null;
            m_state = State.Init;
            m_stateLock = new object();

            m_requestqueue = new WorkQueue<Request>('R');
            m_pendingqueue = new WorkQueue<PendingRequest>('A');

            m_answerCallback = answerCallback_;
            m_request_thread = null;
            m_answer_thread = null;
        }
Example #3
0
 public void ProcessConnectionErrorDelegate(Connection.Error err)
 {
     string errstr = null;
     switch (err)
     {
         case Connection.Error.NoError: m_processError("unknown error"); return;
         case Connection.Error.ConnectionFailed: m_processError("connection failed"); return;
         case Connection.Error.WriteFailed: errstr = "write failed"; break;
         case Connection.Error.ReadFailed: errstr = "read failed"; break;
         case Connection.Error.ConnectionClosed: errstr = "server closed connection"; break;
     }
     HandleUnrecoverableError(errstr);
 }