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

Add user-provided hook to accept/reject connections #401

Merged
merged 6 commits into from
May 27, 2024

Conversation

cBournhonesque
Copy link
Owner

@cBournhonesque cBournhonesque commented May 27, 2024

Fixes #382
Fixes #381

  • Add a field in the NetConfig to provide a closure Fn(ClientId) -> bool to decide if a connection will get accepted or rejected.
  • Add a DeniedReason in the DeniedPacket, which will get showed to the client

TODO:
maybe instead we can pass in a separate object dyn ConnectionRequestHandler with

trait ConnectionRequestHandler {
   fn accept();
   
   fn reject() -> Reason
}

and the user can implement their own?

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 78.26087% with 5 lines in your changes are missing coverage. Please review.

Project coverage is 67.41%. Comparing base (e610332) to head (71ffdf2).

Files Patch % Lines
lightyear/src/connection/netcode/server.rs 64.28% 5 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #401      +/-   ##
==========================================
+ Coverage   66.26%   67.41%   +1.15%     
==========================================
  Files         159      159              
  Lines       10338    10361      +23     
==========================================
+ Hits         6850     6985     +135     
+ Misses       3488     3376     -112     

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

@cBournhonesque cBournhonesque merged commit 9d0dfb7 into main May 27, 2024
3 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide a hook for users to accept a connection in Netcode Add a DeniedReason on the DeniedPacket
2 participants