]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/urldeshortener/serv_expand_shorter_urls.c
don't call curl_multi_add_handle() from outside of the event queue
[citadel.git] / citadel / modules / urldeshortener / serv_expand_shorter_urls.c
index ea37d4034b65ef422f5fd2054522d18fbcc4ad35..dafc0c6347e7630000113090c87b69df2d86d4cd 100644 (file)
@@ -1,3 +1,4 @@
+
 /*
  *
  * Copyright (c) 1998-2009 by the citadel.org team
@@ -93,7 +94,11 @@ size_t GetLocationString( void *ptr, size_t size, size_t nmemb, void *userdata)
        return size * nmemb;
 }
 
-
+eNextState TerminateLookupUrl(AsyncIO *IO)
+{
+//TOOD
+       return eAbort;
+}
 eNextState LookupUrlResult(AsyncIO *IO)
 {
        return eTerminateConnection; /// /TODO
@@ -117,9 +122,10 @@ int LookupUrl(StrBuf *ShorterUrlStr)
 //                       Ctx, 
                          NULL,
                          "Citadel RSS ShorterURL Expander",
-                         LookupUrlResult))
+                         LookupUrlResult, 
+                         TerminateLookupUrl))
        {
-               CtdlLogPrintf(CTDL_ALERT, "Unable to initialize libcurl.\n");
+               syslog(LOG_ALERT, "Unable to initialize libcurl.\n");
                goto shutdown;
        }
        chnd = IO->HttpReq.chnd;
@@ -135,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:
 
@@ -191,7 +197,7 @@ int SortConstStrByPosition(const void *Item1, const void *Item2)
        return -1;
 }
 
-HashList GetShorterUrls(StrBuf Message)
+HashList *GetShorterUrls(StrBuf *Message)
 {
        HashList *pUrls;
        /* we just suspect URL shorteners to be inside of feeds from twitter
@@ -204,7 +210,7 @@ HashList GetShorterUrls(StrBuf Message)
        CrawlMessageForShorterUrls(pUrls, Message);
 
        if (GetCount(pUrls) > 0)
-               return pURLs;
+               return pUrls;
        else 
                return NULL;
 
@@ -321,7 +327,7 @@ CTDL_MODULE_INIT(urldeshortener)
 {
        if (threading)
        {
-               CtdlLogPrintf(CTDL_INFO, "%s\n", curl_version());
+               syslog(LOG_INFO, "%s\n", curl_version());
        }
        else 
        {