Skip to content
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
4 changes: 4 additions & 0 deletions common/main/cpp/native_c4btsocketfactory.cc
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ static void btOpen(C4Socket* socket,
jint envState = attachJVM(&env, "btOpen");
if (envState != JNI_OK && envState != JNI_EDETACHED) return;

// Balanced by the c4socket_release in NativeC4Socket_closed.
c4socket_retain(socket);

// addr->hostname carries the CBL peer-ID / BT MAC address as a C4Slice.
Expand Down Expand Up @@ -178,6 +179,9 @@ static void btAttached(C4Socket* socket) {

jstring jPeerID = env->NewStringUTF((const char *)ctx->peerID.buf);

// Balanced by the c4socket_release in NativeC4Socket_closed. Mirrors btOpen.
c4socket_retain(socket);

env->CallStaticVoidMethod(
cls_C4BTSocketFactory, m_attached,
(jlong) socket,
Expand Down
Loading