修正发送pool bug

This commit is contained in:
sin365 2021-12-27 23:52:27 +08:00
parent af0e472b42
commit 4cb9797f4a
3 changed files with 28 additions and 26 deletions

Binary file not shown.

View File

@ -318,19 +318,18 @@ namespace HaoYueNet.ServerNetwork
void IO_Completed2(object sender, SocketAsyncEventArgs e)
{
// determine which type of operation just completed and call the associated handler
switch (e.LastOperation)
{
case SocketAsyncOperation.Receive:
ProcessReceive(e);
break;
case SocketAsyncOperation.Send:
ProcessSend2(e);
break;
default:
throw new ArgumentException("The last operation completed on the socket was not a receive or send");
}
Console.WriteLine("就他妈从来没进过");
//switch (e.LastOperation)
//{
// case SocketAsyncOperation.Receive:
// ProcessReceive(e);
// break;
// case SocketAsyncOperation.Send:
// ProcessSend2(e);
// break;
// default:
// throw new ArgumentException("The last operation completed on the socket was not a receive or send");
//}
}
// This method is invoked when an asynchronous receive operation completes.
@ -570,6 +569,9 @@ namespace HaoYueNet.ServerNetwork
myreadEventArgs.AcceptSocket = token.Socket;
myreadEventArgs.SetBuffer(message, 0, message.Length); //将数据放置进去.
token.Socket.SendAsync(myreadEventArgs);
//得了,先回去吧
m_Sendpool.Push(myreadEventArgs);
return;
}
else