Skip to content

Commit dc3747c

Browse files
authored
CDRIVER-3638 add non-locking variant of _mongoc_handshake_freeze (#1701)
Fixes recursive lock in `mongoc_handshake_data_append`
1 parent f6971f8 commit dc3747c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,6 +731,12 @@ _mongoc_handshake_freeze (void)
731731
bson_mutex_unlock (&gHandshakeLock);
732732
}
733733

734+
static void
735+
_mongoc_handshake_freeze_nolock (void)
736+
{
737+
_mongoc_handshake_get ()->frozen = true;
738+
}
739+
734740
/*
735741
* free (*s) and make *s point to *s concated with suffix.
736742
* If *s is NULL it's treated like it's an empty string.
@@ -810,7 +816,7 @@ mongoc_handshake_data_append (const char *driver_name, const char *driver_versio
810816
_append_and_truncate (&_mongoc_handshake_get ()->driver_version, driver_version, HANDSHAKE_DRIVER_VERSION_MAX);
811817
}
812818

813-
_mongoc_handshake_freeze ();
819+
_mongoc_handshake_freeze_nolock ();
814820
bson_mutex_unlock (&gHandshakeLock);
815821

816822
return true;

0 commit comments

Comments
 (0)