protected void OnSendError(SendingQueue queue, CloseReason closeReason) { queue.Clear(); m_SendingQueuePool.Push(queue); RemoveStateFlag(SocketState.InSending); ValidateClosed(closeReason); }
protected void OnSendError(SendingQueue queue, CloseReason closeReason) { queue.Clear(); m_SendingQueuePool.Return(queue); OnSendEnd(); ValidateClosed(closeReason); }
protected virtual void OnSendingCompleted(SendingQueue queue) { queue.Clear(); m_SendingQueuePool.Push(queue); var newQueue = m_SendingQueue; if (IsInClosingOrClosed) { //has data is being sent and the socket isn't closed if (newQueue.Count > 0 && !TryValidateClosedBySocket(out Socket client)) { StartSend(newQueue, newQueue.TrackID, false); return; } OnSendEnd(); return; } if (newQueue.Count == 0) { OnSendEnd(); if (newQueue.Count > 0) { StartSend(newQueue, newQueue.TrackID, true); } } else { StartSend(newQueue, newQueue.TrackID, false); } }
protected virtual void OnSendingCompleted(SendingQueue queue) { queue.Clear(); m_SendingQueuePool.Push(queue); if (IsInClosingOrClosed) { RemoveStateFlag(SocketState.InSending); return; } var newQueue = m_SendingQueue; if (newQueue.Count == 0) { RemoveStateFlag(SocketState.InSending); if (newQueue.Count > 0) { StartSend(newQueue, newQueue.TrackID, true); } } else { StartSend(newQueue, newQueue.TrackID, false); } }
private void SAE_SendCompleted(object sender, SocketAsyncEventArgs e) { SendingQueue sendQueue = e.UserToken as SendingQueue; if (sendQueue == SendingQueue.Null) { Trace.Error("未知错误help!~"); } else if (e.SocketError != SocketError.Success) { this.RaiseSended(sendQueue, false); this.SendEnd(sendQueue, CloseReason.Exception, new Exception("send complete error")); } else if (sendQueue.Count <= e.BytesTransferred) { e.SetBuffer(null, 0, 0); e.BufferList = null; this.RaiseSended(sendQueue, true); sendQueue.Clear(); this.Monitor.SendingPool.Release(sendQueue); this.state.RemoveState(SessionState.SENDING); this.PreSend(); } else { sendQueue.TrimByte(e.BytesTransferred); this.InternalSend(sendQueue); } }
private void SendEnd(SendingQueue queue, CloseReason reason, Exception exception) { if (queue != null) { queue.Clear(); this.Monitor.SendingPool.Release(queue); } this.state.RemoveState(SessionState.SENDING); this.Close(reason); }
protected virtual void OnSendingCompleted(SendingQueue queue) { queue.Clear(); m_SendingQueuePool.Return(queue); var newQueue = m_SendingQueue; if (IsInClosingOrClosed) { Socket client; //has data is being sent and the socket isn't closed if (newQueue.Count > 0 && !TryValidateClosedBySocket(out client)) { StartSend(newQueue, newQueue.TrackID, false); return; } OnSendEnd(true); return; } if (newQueue.Count == 0) { OnSendEnd(); if (newQueue.Count > 0) { StartSend(newQueue, newQueue.TrackID, true); } } else { StartSend(newQueue, newQueue.TrackID, false); } }
protected void OnSendError(SendingQueue queue, CloseReason closeReason) { queue.Clear(); m_SendingQueuePool.Push(queue); OnSendEnd(closeReason, true); }
protected virtual void OnSendingCompleted(SendingQueue queue) { queue.Clear(); m_SendingQueuePool.Push(queue); var newQueue = m_SendingQueue; if (newQueue.Count == 0) { m_InSending = 0; if (newQueue.Count > 0) { StartSend(newQueue, newQueue.TrackID, true); } } else { StartSend(newQueue, newQueue.TrackID, false); } }
protected virtual void OnSendingCompleted(SendingQueue queue) { queue.Clear(); m_SendingQueuePool.Push(queue); var newQueue = m_SendingQueue; if (IsInClosingOrClosed) { //has data is being sent and the socket isn't closed if (newQueue.Count > 0 && m_Client != null) { StartSend(newQueue, newQueue.TrackID, false); return; } OnSendEnd(true); return; } if (newQueue.Count == 0) { OnSendEnd(); if (newQueue.Count > 0) { StartSend(newQueue, newQueue.TrackID, true); } } else { StartSend(newQueue, newQueue.TrackID, false); } }