refactored the welcome plugin to use a web api instead of a hard coded file

removed deprecated file class
don't wait for response when setting dvar/sending command in T6
potential fix for duplicate kick message in JS plugin
This commit is contained in:
RaidMax
2018-10-08 21:15:59 -05:00
parent b289917319
commit 7caee55a7e
13 changed files with 57 additions and 296 deletions

View File

@ -95,6 +95,7 @@ namespace SharedLibraryCore.RCon
Ttl = 42,
ExclusiveAddressUse = true,
};
connectionState.OnSentData.Reset();
connectionState.OnReceivedData.Reset();
connectionState.ConnectionAttempts++;
@ -103,7 +104,7 @@ namespace SharedLibraryCore.RCon
#endif
try
{
response = await SendPayloadAsync(payload);
response = await SendPayloadAsync(payload, waitForResponse);
connectionState.OnComplete.Release(1);
connectionState.ConnectionAttempts = 0;
}
@ -139,7 +140,7 @@ namespace SharedLibraryCore.RCon
return splitResponse;
}
private async Task<byte[]> SendPayloadAsync(byte[] payload)
private async Task<byte[]> SendPayloadAsync(byte[] payload, bool waitForResponse)
{
var connectionState = ActiveQueries[this.Endpoint];
var rconSocket = (Socket)connectionState.SendEventArgs.UserToken;
@ -171,6 +172,11 @@ namespace SharedLibraryCore.RCon
}
}
if (!waitForResponse)
{
return new byte[0];
}
connectionState.ReceiveEventArgs.SetBuffer(connectionState.ReceiveBuffer);
// get our response back