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

Improve C++ wrapper. #3769

Merged
merged 2 commits into from
Jul 22, 2023
Merged

Conversation

sebastianpick
Copy link
Contributor

@sebastianpick sebastianpick commented Jul 21, 2023

Description

This PR completes the MsQuicListener implementation in that it adds a proper C++-style MsQuicListenerCallback type. This type is in line with other callback implementations in the C++ wrapper. Furthermore, the PR improves the consistency of some function signatures and adds a few retrieval functions for certain object parameters.

Testing

These changes are affect certain tests, which have been updated accordingly. New API additions where not added to the tests.

Documentation

Smaller API changes and additions have been made and might require doc updates.

@sebastianpick sebastianpick requested a review from a team as a code owner July 21, 2023 15:23
@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Merging #3769 (958475e) into main (69784e2) will decrease coverage by 0.02%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main    #3769      +/-   ##
==========================================
- Coverage   75.59%   75.57%   -0.02%     
==========================================
  Files          56       56              
  Lines       15554    15554              
==========================================
- Hits        11758    11755       -3     
- Misses       3796     3799       +3     

see 11 files with indirect coverage changes

Comment on lines 789 to 798
static
QUIC_STATUS
QUIC_API
NoOpCallback(
_In_ MsQuicListener* /* Listener */,
_In_opt_ void* /* Context */,
_Inout_ QUIC_LISTENER_EVENT* /* Event */
) noexcept {
return QUIC_STATUS_SUCCESS;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fix formatting and we need to return an error by default, otherwise it would just accept a connection and leak it.

Suggested change
static
QUIC_STATUS
QUIC_API
NoOpCallback(
_In_ MsQuicListener* /* Listener */,
_In_opt_ void* /* Context */,
_Inout_ QUIC_LISTENER_EVENT* /* Event */
) noexcept {
return QUIC_STATUS_SUCCESS;
}
static
QUIC_STATUS
QUIC_API
NoOpCallback(
_In_ MsQuicListener* /* Listener */,
_In_opt_ void* /* Context */,
_Inout_ QUIC_LISTENER_EVENT* /* Event */
) noexcept {
return QUIC_STATUS_NOT_SUPPORTED;
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, I'm not sure it ever makes sense to have a no-op callback for a listener. Maybe we just remove it and always require a callback.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense. I will remove this an also update the default parameters in the MsQuicListener c'tor.

};

typedef QUIC_STATUS MsQuicListenerCallback(
_In_ struct MsQuicListener* listener,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_In_ struct MsQuicListener* listener,
_In_ struct MsQuicListener* Listener,

@@ -129,7 +129,7 @@ PerfServer::GetExtraData(

QUIC_STATUS
PerfServer::ListenerCallback(
_In_ HQUIC /*ListenerHandle*/,
_In_ MsQuicListener* /*ListenerHandle*/,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_In_ MsQuicListener* /*ListenerHandle*/,
_In_ MsQuicListener* /*Listener*/,

@@ -90,14 +90,14 @@ class PerfServer : public PerfBase {

QUIC_STATUS
ListenerCallback(
_In_ HQUIC ListenerHandle,
_In_ MsQuicListener* ListenerHandle,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's update ListenerHandle to Listener here and the others below.

Comment on lines 343 to 347
QUIC_API
DummyListenerCallback(
T,
void* Context,
QUIC_LISTENER_EVENT* Event
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
QUIC_API
DummyListenerCallback(
T,
void* Context,
QUIC_LISTENER_EVENT* Event
QUIC_API
DummyListenerCallback(
T,
void* Context,
QUIC_LISTENER_EVENT* Event

@nibanks nibanks merged commit 734702f into microsoft:main Jul 22, 2023
407 of 408 checks passed
@sebastianpick sebastianpick deleted the feature/improveCppWrapper branch January 8, 2024 16:13
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.

None yet

2 participants