gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r12235 - gnunet/src/transport


From: gnunet
Subject: [GNUnet-SVN] r12235 - gnunet/src/transport
Date: Thu, 15 Jul 2010 10:23:22 +0200

Author: wachs
Date: 2010-07-15 10:23:22 +0200 (Thu, 15 Jul 2010)
New Revision: 12235

Modified:
   gnunet/src/transport/plugin_transport_http.c
Log:
FIX BUG: Adding invalid curl PUT handle to multihandle causing error


Modified: gnunet/src/transport/plugin_transport_http.c
===================================================================
--- gnunet/src/transport/plugin_transport_http.c        2010-07-14 13:15:48 UTC 
(rev 12234)
+++ gnunet/src/transport/plugin_transport_http.c        2010-07-15 08:23:22 UTC 
(rev 12235)
@@ -1225,7 +1225,8 @@
         if (mret != CURLM_OK)
         {
           GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                      _("%s failed at %s:%d: `%s'\n"),
+                                         _("Connection: %X: %s failed at 
%s:%d: `%s'\n"),
+                                         ps,
                       "curl_multi_add_handle", __FILE__, __LINE__,
                       curl_multi_strerror (mret));
           return GNUNET_SYSERR;
@@ -1269,39 +1270,42 @@
     }
     /* not connected, initiate connection */
     if ((ps->send_connected==GNUNET_NO) && (NULL == ps->send_endpoint))
-      ps->send_endpoint = curl_easy_init();
-    GNUNET_assert (ps->send_endpoint != NULL);
-    GNUNET_assert (NULL != ps->pending_msgs_tail);
+    {
+       ps->send_endpoint = curl_easy_init();
+               GNUNET_assert (ps->send_endpoint != NULL);
+               GNUNET_assert (NULL != ps->pending_msgs_tail);
 #if DEBUG_CONNECTIONS
-    GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: outbound not 
connected, initiating connection\n",ps);
+               GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"Connection %X: outbound 
not connected, initiating connection\n",ps);
 #endif
-    ps->send_active = GNUNET_NO;
-    msg = ps->pending_msgs_tail;
+               ps->send_active = GNUNET_NO;
+               msg = ps->pending_msgs_tail;
 
-  #if DEBUG_CURL
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_VERBOSE, 1L);
-  #endif
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_URL, ps->url);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_PUT, 1L);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_HEADERFUNCTION, 
&curl_put_header_function);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_WRITEHEADER, ps);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_READFUNCTION, curl_send_cb);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_READDATA, ps);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_WRITEFUNCTION, 
curl_receive_cb);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_READDATA, ps);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_TIMEOUT, (long) timeout.value);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, 
HTTP_CONNECT_TIMEOUT);
-    curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, 
GNUNET_SERVER_MAX_MESSAGE_SIZE);
+#if DEBUG_CURL
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_VERBOSE, 1L);
+#endif
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_URL, ps->url);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_PUT, 1L);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_HEADERFUNCTION, 
&curl_put_header_function);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_WRITEHEADER, ps);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_READFUNCTION, 
curl_send_cb);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_READDATA, ps);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_WRITEFUNCTION, 
curl_receive_cb);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_READDATA, ps);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_TIMEOUT, (long) 
timeout.value);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_PRIVATE, ps);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_CONNECTTIMEOUT, 
HTTP_CONNECT_TIMEOUT);
+               curl_easy_setopt(ps->send_endpoint, CURLOPT_BUFFERSIZE, 
GNUNET_SERVER_MAX_MESSAGE_SIZE);
 
-    mret = curl_multi_add_handle(plugin->multi_handle, ps->send_endpoint);
-    if (mret != CURLM_OK)
-    {
-      GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
-                  _("%s failed at %s:%d: `%s'\n"),
-                  "curl_multi_add_handle", __FILE__, __LINE__,
-                  curl_multi_strerror (mret));
-      return GNUNET_SYSERR;
+               mret = curl_multi_add_handle(plugin->multi_handle, 
ps->send_endpoint);
+               if (mret != CURLM_OK)
+               {
+                 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
+                                         _("Connection: %X: %s failed at 
%s:%d: `%s'\n"),
+                                         ps,
+                                         "curl_multi_add_handle", __FILE__, 
__LINE__,
+                                         curl_multi_strerror (mret));
+                 return GNUNET_SYSERR;
+               }
     }
     if (curl_schedule (plugin) == GNUNET_SYSERR)
        return GNUNET_SYSERR;
@@ -1310,8 +1314,8 @@
   if (ps->direction == INBOUND)
   {
     GNUNET_assert (NULL != ps->pending_msgs_tail);
-    msg = ps->pending_msgs_tail;
-    if ((ps->recv_connected==GNUNET_YES) && (ps->send_connected==GNUNET_YES))
+    if ((ps->recv_connected==GNUNET_YES) && (ps->send_connected==GNUNET_YES) &&
+       (ps->recv_force_disconnect==GNUNET_NO) && 
(ps->recv_force_disconnect==GNUNET_NO))
        return GNUNET_YES;
   }
   return GNUNET_SYSERR;
@@ -2023,7 +2027,6 @@
       t6->u6_port = htons (plugin->port_inbound);
       plugin->env->notify_address(plugin->env->cls,"http",t6,sizeof (struct 
IPv6HttpAddress) , GNUNET_TIME_UNIT_FOREVER_REL);
     }
-  return GNUNET_NO;
   return GNUNET_OK;
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]