[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#591891: libdbus-ocaml-dev: Possible conflict between 2 OCaml bindings: dBus and ssl



reassign ocaml-ssl

Straightforward patch attached.

-- 
 ygrek
 http://ygrek.org.ua/
diff -r -u ocaml-ssl-0.4.4/src/ssl_stubs.c ocaml-ssl-0.4.4-patch/src/ssl_stubs.c
--- ocaml-ssl-0.4.4/src/ssl_stubs.c	2010-01-06 11:34:00.000000000 +0200
+++ ocaml-ssl-0.4.4-patch/src/ssl_stubs.c	2010-11-09 22:37:54.000000000 +0200
@@ -58,10 +58,14 @@
 
 #define Ctx_val(v) (*((SSL_CTX**)Data_custom_val(v)))
 
+static int ssl_acquire_runtime_lock = 1;
+
 static void finalize_ctx(value block)
 {
   SSL_CTX *ctx = Ctx_val(block);
+  ssl_acquire_runtime_lock = 0;
   SSL_CTX_free(ctx);
+  ssl_acquire_runtime_lock = 1;
 }
 
 static struct custom_operations ctx_ops =
@@ -81,7 +85,9 @@
 static void finalize_ssl_socket(value block)
 {
   SSL *ssl = SSL_val(block);
+  ssl_acquire_runtime_lock = 0;
   SSL_free(ssl);
+  ssl_acquire_runtime_lock = 1;
 }
 
 static struct custom_operations socket_ops =
@@ -108,7 +114,8 @@
 {
   value lf;
 
-  caml_leave_blocking_section();
+  if (ssl_acquire_runtime_lock)
+    caml_leave_blocking_section();
 
   lf = Field(Field(*caml_named_value("caml_ssl_thread_locking_function"), 0), 0);
   if (mode & CRYPTO_LOCK)
@@ -116,7 +123,8 @@
   else
     caml_callback2(lf, Val_int(n), Val_int(0));
 
-  caml_enter_blocking_section();
+  if (ssl_acquire_runtime_lock)
+    caml_enter_blocking_section();
 }
 
 unsigned long id_function()

Reply to: