// 서버에서 강제로 제거 용 public void ForceDisconnect(CloseReason reason = CloseReason.Unknown) { try { if (reason == CloseReason.RemoteClose) { Logger.Debug("ForceDisconnect: {0}", reason); } else { Logger.Log("ForceDisconnect: {0}", reason); } if (true == m_bClosing.SetTrue()) { // [ MUSTBE BY KWJ ] : 20150212 // OnDisconnected 메소드 처리 내용 수정하자. // 굳이 세션메니저에서 처리할 내용인가?에 대해서 다시 생각해보자. OnDisconnected(reason); OnClose(); Close(); m_bClosed.ForceTrue(); } } catch (Exception ex) { Logger.Log(ex.ToString()); } }
public virtual bool Stop() { if (false == m_bStopped.SetTrue()) { return(false); } Logger.Info("Server Stop"); return(true); }
public void StartSend() { if (false == IsConnected()) { return; } if (m_queueSend.Count <= 0) { return; } // send 할 때 setTrue를 하지 못하는 경우가 발생 보내지마. if (false == m_bSending.SetTrue()) { return; } try { m_listSend.Clear(); ArraySegment <byte> arrSegment; while (m_queueSend.TryDequeue(out arrSegment)) { m_listSend.Add(arrSegment); } m_saeaSender.BufferList = m_listSend; bool willRaiseEvent = m_socket.SendAsync(m_saeaSender); // I/O 작업이 동기적으로 완료된 경우 false를 반환합니다. // 이 경우에는 e 매개 변수에서 SocketAsyncEventArgs.Completed 이벤트가 발생하지 않으며, // 메서드 호출이 반환된 직후 매개 변수로 전달된 e 개체를 검사하여 작업 결과를 검색할 수 있습니다. if (false == willRaiseEvent) { ProcessSend(m_saeaSender); } } catch (Exception ex) { OnError(string.Format("StartReceive {0}", ex.ToString())); m_bSending.ForceFalse(); ForceDisconnect(CloseReason.SocketError); return; } }