Raise SocketAsyncEventArgs buffer for UDP server

Related to issue #602
This commit is contained in:
Travis Nickles 2019-03-11 12:48:16 -05:00
parent 76b31245f8
commit 695d9b3e31

View File

@ -81,8 +81,8 @@ namespace DS4Windows
public UdpServer(GetPadDetail getPadDetailDel) public UdpServer(GetPadDetail getPadDetailDel)
{ {
portInfoGet = getPadDetailDel; portInfoGet = getPadDetailDel;
argsList = new SocketAsyncEventArgs[20]; argsList = new SocketAsyncEventArgs[40];
for (int num = 0; num <= 19; num++) for (int num = 0; num < 40; num++)
{ {
SocketAsyncEventArgs args = new SocketAsyncEventArgs(); SocketAsyncEventArgs args = new SocketAsyncEventArgs();
args.SetBuffer(new byte[100], 0, 100); args.SetBuffer(new byte[100], 0, 100);
@ -188,7 +188,7 @@ namespace DS4Windows
int temp = 0; int temp = 0;
poolLock.EnterWriteLock(); poolLock.EnterWriteLock();
temp = listInd; temp = listInd;
listInd = ++listInd % 20; listInd = ++listInd % 40;
SocketAsyncEventArgs args = argsList[temp]; SocketAsyncEventArgs args = argsList[temp];
poolLock.ExitWriteLock(); poolLock.ExitWriteLock();
@ -654,7 +654,7 @@ namespace DS4Windows
int temp = 0; int temp = 0;
poolLock.EnterWriteLock(); poolLock.EnterWriteLock();
temp = listInd; temp = listInd;
listInd = ++listInd % 20; listInd = ++listInd % 40;
SocketAsyncEventArgs args = argsList[temp]; SocketAsyncEventArgs args = argsList[temp];
poolLock.ExitWriteLock(); poolLock.ExitWriteLock();