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

CBL-6378: Crash when calling onWebSocketGotTLSCertificate callback af… #2177

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion Networking/BLIP/BLIPConnection.cc
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ namespace litecore::blip {
enqueue(FUNCTION_TO_QUEUE(BLIPIO::_gotHTTPResponse), status, headers);
}

void onWebSocketGotTLSCertificate(slice certData) override { _connection->gotTLSCertificate(certData); }
virtual void onWebSocketGotTLSCertificate(slice certData) override {
enqueue(FUNCTION_TO_QUEUE(BLIPIO::_gotTLSCertificate), alloc_slice{certData});
}

// websocket::Delegate interface:
void onWebSocketConnect() override {
Expand Down Expand Up @@ -210,6 +212,11 @@ namespace litecore::blip {
if ( _connection ) _connection->gotHTTPResponse(status, headers);
}

void _gotTLSCertificate(alloc_slice certData) {
// _connection is reset to nullptr in _closed.
if ( _connection ) _connection->gotTLSCertificate(certData);
}

void _onWebSocketConnect() {
// _connection is reset to nullptr in _closed.
if ( _connection ) {
Expand Down
Loading