//-------------------------------------------------------------------- public void DeRegisterSession(CDEFSession sess) { if (mSessions.ContainsKey(sess.GetKey)) { mSessions.Remove(sess.GetKey); } // // If it is the last session and we are not waiting for // a disconnect as a result of sending a 3309 // if ((mSessions.Count == 0) && !mDisconnect.WaitOne(0, false)) { Disconnect(); } }
public void SessionDisconnectedEvt(CDEFSession source) { mDiconnected(source); }
public void SessionConnectFailedEvt(CDEFSession source, int timeout) { mConFail(source, timeout); }
public void SessionConnectedEvt(CDEFSession source) { mConnected(source); }
public void MessageReadyEvt(CDEFSession source) { mMsgRec(source); }
public bool InterestedCb(CDEFSession source, byte[] buffer, int idx, int bufferLength) { return mInterested(source, buffer, idx, bufferLength); }
//-------------------------------------------------------------------- /// <summary> /// Inform the upper layers of event that have occured /// </summary> protected override void DisconnectedEvt(Exception e) { string msg; DisableHeartbeats(); if (e != null) { msg = "Remote Disconnect for " + IP + " " + Port + " Msg: " + e.Message; } else { msg = "Disconnect for " + IP + " " + Port + " current state: " + State.GetState(); } mLogger.Write(mUniqueID, "CDEF_TCPCon", msg, LogLevel.Warning); mOwner.DisconnectedEvt(mUniqueID); CDEFSession[] sessArr = new CDEFSession[mSessions.Count]; mSessions.Values.CopyTo(sessArr, 0); foreach (CDEFSession s in sessArr) { s.ConnectionLostEvt(); } }
//-------------------------------------------------------------------- public void RegisterSession(CDEFSession sess) { if (mSessions.ContainsKey(sess.GetKey)) { throw new Exception("Session: " + sess.ToString() + " already exists on connection " + this.ToString()); } else { mSessions.Add(sess.GetKey, sess); } }