static MONGOC_ONCE_FUN( _mongoc_do_init)
{
#ifdef MONGOC_ENABLE_SSL
   _mongoc_ssl_init();
   _mongoc_scram_startup();
#endif

   _mongoc_counters_init();

#ifdef _WIN32
   {
      WORD wVersionRequested;
      WSADATA wsaData;
      int err;

      wVersionRequested = MAKEWORD (2, 2);

      err = WSAStartup (wVersionRequested, &wsaData);

      /* check the version perhaps? */

      assert (err == 0);

      atexit ((void(*)(void))WSACleanup);
   }
#endif

   MONGOC_ONCE_RETURN;
}
Beispiel #2
0
static MONGOC_ONCE_FUN( _mongoc_do_init)
{
#ifdef MONGOC_ENABLE_SSL_OPENSSL
   _mongoc_openssl_init();
#endif

#ifdef MONGOC_ENABLE_SSL
   _mongoc_scram_startup();
#endif

#ifdef MONGOC_ENABLE_SASL
   /* The following functions should not use tracing, as they may be invoked
    * before mongoc_log_set_handler() can complete. */
   sasl_set_mutex (mongoc_sasl_mutex_alloc,
                   mongoc_sasl_mutex_lock,
                   mongoc_sasl_mutex_unlock,
                   mongoc_sasl_mutex_free);

   /* TODO: logging callback? */
   sasl_client_init (NULL);
#endif

   _mongoc_counters_init();

#ifdef _WIN32
   {
      WORD wVersionRequested;
      WSADATA wsaData;
      int err;

      wVersionRequested = MAKEWORD (2, 2);

      err = WSAStartup (wVersionRequested, &wsaData);

      /* check the version perhaps? */

      BSON_ASSERT (err == 0);
   }
#endif

   MONGOC_ONCE_RETURN;
}