Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(udp): switch to channel mode #46

Merged
merged 1 commit into from
Dec 29, 2023
Merged

refactor(udp): switch to channel mode #46

merged 1 commit into from
Dec 29, 2023

Conversation

flc1125
Copy link
Contributor

@flc1125 flc1125 commented Dec 29, 2023

No description provided.

Copy link

what-the-diff bot commented Dec 29, 2023

PR Summary

  • Refactor in UDP server configuration options

    • The functions WithHandler and WithRecoveryHandler have been simplified, now only requiring a singular 'Message' object which encapsulates key information from a UDP connection. This makes it easier and simpler to set up a UDP server.
  • UDP Message Struct added

    • A new Message struct has been included which consolidates the Conn, Addr and Body of a UDP message into one package, aiding in organization of data.
  • Inclusion of read channel

    • Read channel, readChan is added to accept incoming UDP messages. There is an additional capability to define the size of this channel via readChanSize.
  • Asynchronous behaviour enabled

    • To improve efficiency, a start goroutine has been implemented to constantly read from the UDP connection and process the incoming messages. Correspondingly a stop function added to halt the goroutine when required.
  • Reworked testing methodology

    • Incorporated the aforementioned changes into the test suite for consistency by using the new logic and parameters. Simpler, more unified tests should lead to better maintenance and understanding going forward.

Copy link

codecov bot commented Dec 29, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (0d805ae) 70.88% compared to head (f6c5aa0) 71.44%.

Files Patch % Lines
udp/server.go 78.04% 8 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master      #46      +/-   ##
==========================================
+ Coverage   70.88%   71.44%   +0.56%     
==========================================
  Files          22       22              
  Lines         680      711      +31     
==========================================
+ Hits          482      508      +26     
- Misses        182      187       +5     
  Partials       16       16              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@flc1125 flc1125 merged commit 5ddec00 into master Dec 29, 2023
6 checks passed
@flc1125 flc1125 deleted the feat-udp-channel branch December 29, 2023 03:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant