mirror of
https://github.com/TechnitiumSoftware/DnsServer.git
synced 2026-10-12 02:09:51 +00:00
DnsServer: Updated ProcessUdpRequestAsync() to ensure that buffer size is never less than 512. Updated ProcessDoHRequestAsync() to suppress send timeout error.
This commit is contained in:
@@ -2043,7 +2043,7 @@ namespace DnsServerCore.Dns
|
||||
//send response
|
||||
int sendBufferSize;
|
||||
|
||||
if (request.EDNS is null)
|
||||
if ((request.EDNS is null) || (request.EDNS.UdpPayloadSize < 512))
|
||||
sendBufferSize = 512;
|
||||
else if (request.EDNS.UdpPayloadSize > _udpPayloadSize)
|
||||
sendBufferSize = _udpPayloadSize;
|
||||
@@ -2715,13 +2715,21 @@ namespace DnsServerCore.Dns
|
||||
response.ContentType = "application/dns-message";
|
||||
response.ContentLength = mS.Length;
|
||||
|
||||
await TechnitiumLibrary.TaskExtensions.TimeoutAsync(async delegate (CancellationToken cancellationToken1)
|
||||
try
|
||||
{
|
||||
await using (Stream s = response.Body)
|
||||
await TechnitiumLibrary.TaskExtensions.TimeoutAsync(async delegate (CancellationToken cancellationToken1)
|
||||
{
|
||||
await mS.CopyToAsync(s, 512, cancellationToken1);
|
||||
}
|
||||
}, _tcpSendTimeout, cancellationToken);
|
||||
await using (Stream s = response.Body)
|
||||
{
|
||||
await mS.CopyToAsync(s, 512, cancellationToken1);
|
||||
}
|
||||
}, _tcpSendTimeout, cancellationToken);
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
//do not log send timeout exception
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
_queryLog?.Write(remoteEP, DnsTransportProtocol.Https, dnsRequest, dnsResponse);
|
||||
|
||||
Reference in New Issue
Block a user