Skip to content

Commit 0832ea5

Browse files
committed
CDRIVER-3638 add non-locking variant of _mongoc_handshake_freeze (#1701)
Fixes recursive lock in `mongoc_handshake_data_append`
1 parent 2735d55 commit 0832ea5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/libmongoc/src/mongoc/mongoc-handshake.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,12 @@ _mongoc_handshake_freeze (void)
725725
bson_mutex_unlock (&gHandshakeLock);
726726
}
727727

728+
static void
729+
_mongoc_handshake_freeze_nolock (void)
730+
{
731+
_mongoc_handshake_get ()->frozen = true;
732+
}
733+
728734
/*
729735
* free (*s) and make *s point to *s concated with suffix.
730736
* If *s is NULL it's treated like it's an empty string.
@@ -804,7 +810,7 @@ mongoc_handshake_data_append (const char *driver_name, const char *driver_versio
804810
_append_and_truncate (&_mongoc_handshake_get ()->driver_version, driver_version, HANDSHAKE_DRIVER_VERSION_MAX);
805811
}
806812

807-
_mongoc_handshake_freeze ();
813+
_mongoc_handshake_freeze_nolock ();
808814
bson_mutex_unlock (&gHandshakeLock);
809815

810816
return true;

0 commit comments

Comments
 (0)