ameshkov / dnscrypt

DNSCrypt v2 protocol implementation + a command-line tool
The Unlicense
74 stars 14 forks source link

Graceful shutdown of the DNSCrypt server #6

Closed ameshkov closed 3 years ago

ameshkov commented 3 years ago

This PR implements Server.Shutdown(ctx context.Context) method that allows to shut down the DNSCrypt server gracefully.

Some additional changes that were inadvertently made while doing that:

  1. Added benchmark tests
  2. Started using dns.ReadFromSessionUDP / dns.WriteToSessionUDP instead of implementing it by ourselves
codecov-io commented 3 years ago

Codecov Report

Merging #6 (1804994) into master (d0ae1d1) will increase coverage by 1.00%. The diff coverage is 72.04%.

:exclamation: Current head 1804994 differs from pull request most recent head eb33a45. Consider uploading reports for the commit eb33a45 to get more accurate results Impacted file tree graph

@@            Coverage Diff             @@
##           master       #6      +/-   ##
==========================================
+ Coverage   63.94%   64.95%   +1.00%     
==========================================
  Files          14       13       -1     
  Lines         735      816      +81     
==========================================
+ Hits          470      530      +60     
- Misses        167      185      +18     
- Partials       98      101       +3     
Impacted Files Coverage Δ
cert.go 72.00% <ø> (ø)
client.go 65.67% <ø> (ø)
constants.go 37.50% <0.00%> (-5.36%) :arrow_down:
encrypted_query.go 66.03% <ø> (ø)
encrypted_response.go 77.27% <ø> (ø)
generate.go 59.01% <ø> (ø)
handler.go 0.00% <ø> (ø)
server_tcp.go 62.92% <69.11%> (+3.30%) :arrow_up:
server_udp.go 65.90% <74.32%> (+9.90%) :arrow_up:
server.go 61.46% <74.41%> (+9.99%) :arrow_up:
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d0ae1d1...eb33a45. Read the comment docs.