don't call curl_multi_add_handle() from outside of the event queue
[citadel.git] / citadel / modules / urldeshortener / serv_expand_shorter_urls.c
index 7dc2096682f590b4577ead56bcbf1891e5f00b2f..dafc0c6347e7630000113090c87b69df2d86d4cd 100644 (file)
@@ -1,3 +1,4 @@
+
 /*
  *
  * Copyright (c) 1998-2009 by the citadel.org team
@@ -96,6 +97,7 @@ size_t GetLocationString( void *ptr, size_t size, size_t nmemb, void *userdata)
 eNextState TerminateLookupUrl(AsyncIO *IO)
 {
 //TOOD
+       return eAbort;
 }
 eNextState LookupUrlResult(AsyncIO *IO)
 {
@@ -123,7 +125,7 @@ int LookupUrl(StrBuf *ShorterUrlStr)
                          LookupUrlResult, 
                          TerminateLookupUrl))
        {
-               CtdlLogPrintf(CTDL_ALERT, "Unable to initialize libcurl.\n");
+               syslog(LOG_ALERT, "Unable to initialize libcurl.\n");
                goto shutdown;
        }
        chnd = IO->HttpReq.chnd;
@@ -139,10 +141,10 @@ int LookupUrl(StrBuf *ShorterUrlStr)
        OPT(WRITEHEADER, ShorterUrlStr);
 
 
-       if (CtdlThreadCheckStop())
+       if (server_shutting_down)
                goto shutdown ;
 
-       evcurl_handle_start(IO);
+       QueueCurlContext(IO);
 
 shutdown:
 
@@ -325,7 +327,7 @@ CTDL_MODULE_INIT(urldeshortener)
 {
        if (threading)
        {
-               CtdlLogPrintf(CTDL_INFO, "%s\n", curl_version());
+               syslog(LOG_INFO, "%s\n", curl_version());
        }
        else 
        {