aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_client.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2014-06-26 09:00:46 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2014-06-26 09:00:46 +0000
commite81a085db0c1e50727097b60124e9c590ab01baa (patch)
tree7531968e1479d8425e7e26e2fb4e2c960ba18596 /src/transport/plugin_transport_http_client.c
parentd3ffb7fc6924ee9eef6e7ef0e09236fb57987b30 (diff)
downloadgnunet-e81a085db0c1e50727097b60124e9c590ab01baa.tar.gz
gnunet-e81a085db0c1e50727097b60124e9c590ab01baa.zip
target not required anymore since we use HELLO_ADDRESSES
Diffstat (limited to 'src/transport/plugin_transport_http_client.c')
-rw-r--r--src/transport/plugin_transport_http_client.c41
1 files changed, 17 insertions, 24 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c
index 593b063ab..7a50ebd38 100644
--- a/src/transport/plugin_transport_http_client.c
+++ b/src/transport/plugin_transport_http_client.c
@@ -135,12 +135,6 @@ struct ConnectionHandle
135struct Session 135struct Session
136{ 136{
137 /** 137 /**
138 * To whom are we talking to (set to our identity
139 * if we are still waiting for the welcome message)
140 */
141 struct GNUNET_PeerIdentity target;
142
143 /**
144 * The URL to connect to 138 * The URL to connect to
145 */ 139 */
146 char *url; 140 char *url;
@@ -437,7 +431,7 @@ client_delete_session (struct Session *s)
437 } 431 }
438 GNUNET_assert (GNUNET_OK == 432 GNUNET_assert (GNUNET_OK ==
439 GNUNET_CONTAINER_multipeermap_remove (plugin->sessions, 433 GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
440 &s->target, 434 &s->address->peer,
441 s)); 435 s));
442 if (NULL != s->client_put) 436 if (NULL != s->client_put)
443 { 437 {
@@ -445,7 +439,7 @@ client_delete_session (struct Session *s)
445 "Session %p/connection %p: disconnecting PUT connection to peer `%s'\n", 439 "Session %p/connection %p: disconnecting PUT connection to peer `%s'\n",
446 s, 440 s,
447 s->client_put, 441 s->client_put,
448 GNUNET_i2s (&s->target)); 442 GNUNET_i2s (&s->address->peer));
449 443
450 /* remove curl handle from multi handle */ 444 /* remove curl handle from multi handle */
451 mret = curl_multi_remove_handle (plugin->curl_multi_handle, 445 mret = curl_multi_remove_handle (plugin->curl_multi_handle,
@@ -459,7 +453,7 @@ client_delete_session (struct Session *s)
459 LOG (GNUNET_ERROR_TYPE_DEBUG, 453 LOG (GNUNET_ERROR_TYPE_DEBUG,
460 "Session %p/connection %p: disconnecting GET connection to peer `%s'\n", 454 "Session %p/connection %p: disconnecting GET connection to peer `%s'\n",
461 s, s->client_get, 455 s, s->client_get,
462 GNUNET_i2s (&s->target)); 456 GNUNET_i2s (&s->address->peer));
463 /* remove curl handle from multi handle */ 457 /* remove curl handle from multi handle */
464 mret = curl_multi_remove_handle (plugin->curl_multi_handle, 458 mret = curl_multi_remove_handle (plugin->curl_multi_handle,
465 s->client_get); 459 s->client_get);
@@ -486,7 +480,7 @@ client_delete_session (struct Session *s)
486 s->bytes_in_queue -= pos->size; 480 s->bytes_in_queue -= pos->size;
487 if (NULL != pos->transmit_cont) 481 if (NULL != pos->transmit_cont)
488 pos->transmit_cont (pos->transmit_cont_cls, 482 pos->transmit_cont (pos->transmit_cont_cls,
489 &s->target, 483 &s->address->peer,
490 GNUNET_SYSERR, 484 GNUNET_SYSERR,
491 pos->size, 485 pos->size,
492 pos->pos + s->overhead); 486 pos->pos + s->overhead);
@@ -720,7 +714,7 @@ http_client_plugin_send (void *cls,
720 LOG (GNUNET_ERROR_TYPE_DEBUG, 714 LOG (GNUNET_ERROR_TYPE_DEBUG,
721 "Session %p/connection %p: Sending message with %u to peer `%s' \n", 715 "Session %p/connection %p: Sending message with %u to peer `%s' \n",
722 s, s->client_put, 716 s, s->client_put,
723 msgbuf_size, GNUNET_i2s (&s->target)); 717 msgbuf_size, GNUNET_i2s (&s->address->peer));
724 718
725 /* create new message and schedule */ 719 /* create new message and schedule */
726 msg = GNUNET_malloc (sizeof (struct HTTP_Message) + msgbuf_size); 720 msg = GNUNET_malloc (sizeof (struct HTTP_Message) + msgbuf_size);
@@ -1035,7 +1029,7 @@ client_send_cb (void *stream,
1035 s->bytes_in_queue -= msg->size; 1029 s->bytes_in_queue -= msg->size;
1036 if (NULL != msg->transmit_cont) 1030 if (NULL != msg->transmit_cont)
1037 msg->transmit_cont (msg->transmit_cont_cls, 1031 msg->transmit_cont (msg->transmit_cont_cls,
1038 &s->target, 1032 &s->address->peer,
1039 GNUNET_OK, 1033 GNUNET_OK,
1040 msg->size, 1034 msg->size,
1041 msg->size + s->overhead); 1035 msg->size + s->overhead);
@@ -1146,7 +1140,7 @@ client_receive_mst_cb (void *cls,
1146 { 1140 {
1147 LOG (GNUNET_ERROR_TYPE_DEBUG, 1141 LOG (GNUNET_ERROR_TYPE_DEBUG,
1148 "Client: peer `%s' address `%s' next read delayed for %s\n", 1142 "Client: peer `%s' address `%s' next read delayed for %s\n",
1149 GNUNET_i2s (&s->target), 1143 GNUNET_i2s (&s->address->peer),
1150 http_common_plugin_address_to_string (s->plugin->protocol, 1144 http_common_plugin_address_to_string (s->plugin->protocol,
1151 s->address->address, 1145 s->address->address,
1152 s->address->address_length), 1146 s->address->address_length),
@@ -1201,7 +1195,7 @@ client_receive (void *stream,
1201 LOG (GNUNET_ERROR_TYPE_DEBUG, 1195 LOG (GNUNET_ERROR_TYPE_DEBUG,
1202 "Session %p / connection %p: Received %u bytes from peer `%s'\n", 1196 "Session %p / connection %p: Received %u bytes from peer `%s'\n",
1203 s, s->client_get, 1197 s, s->client_get,
1204 len, GNUNET_i2s (&s->target)); 1198 len, GNUNET_i2s (&s->address->peer));
1205 now = GNUNET_TIME_absolute_get (); 1199 now = GNUNET_TIME_absolute_get ();
1206 if (now.abs_value_us < s->next_receive.abs_value_us) 1200 if (now.abs_value_us < s->next_receive.abs_value_us)
1207 { 1201 {
@@ -1298,7 +1292,7 @@ curl_easy_getinfo (easy_h,
1298 LOG (GNUNET_ERROR_TYPE_DEBUG, 1292 LOG (GNUNET_ERROR_TYPE_DEBUG,
1299 "Session %p/connection %p: PUT connection to `%s' ended with status %i reason %i: `%s'\n", 1293 "Session %p/connection %p: PUT connection to `%s' ended with status %i reason %i: `%s'\n",
1300 s, msg->easy_handle, 1294 s, msg->easy_handle,
1301 GNUNET_i2s (&s->target), 1295 GNUNET_i2s (&s->address->peer),
1302 http_statuscode, 1296 http_statuscode,
1303 msg->data.result, 1297 msg->data.result,
1304 curl_easy_strerror (msg->data.result)); 1298 curl_easy_strerror (msg->data.result));
@@ -1307,7 +1301,7 @@ curl_easy_getinfo (easy_h,
1307 LOG (GNUNET_ERROR_TYPE_DEBUG, 1301 LOG (GNUNET_ERROR_TYPE_DEBUG,
1308 "Session %p/connection %p: PUT connection to `%s' ended normal\n", 1302 "Session %p/connection %p: PUT connection to `%s' ended normal\n",
1309 s, msg->easy_handle, 1303 s, msg->easy_handle,
1310 GNUNET_i2s (&s->target)); 1304 GNUNET_i2s (&s->address->peer));
1311 if (NULL == s->client_get) 1305 if (NULL == s->client_get)
1312 { 1306 {
1313 /* Disconnect other transmission direction and tell transport */ 1307 /* Disconnect other transmission direction and tell transport */
@@ -1347,7 +1341,7 @@ curl_easy_getinfo (easy_h,
1347 "Session %p/connection %p: GET connection to `%s' ended with status %i reason %i: `%s'\n", 1341 "Session %p/connection %p: GET connection to `%s' ended with status %i reason %i: `%s'\n",
1348 s, 1342 s,
1349 msg->easy_handle, 1343 msg->easy_handle,
1350 GNUNET_i2s (&s->target), 1344 GNUNET_i2s (&s->address->peer),
1351 http_statuscode, 1345 http_statuscode,
1352 msg->data.result, 1346 msg->data.result,
1353 curl_easy_strerror (msg->data.result)); 1347 curl_easy_strerror (msg->data.result));
@@ -1358,7 +1352,7 @@ curl_easy_getinfo (easy_h,
1358 "Session %p/connection %p: GET connection to `%s' ended normal\n", 1352 "Session %p/connection %p: GET connection to `%s' ended normal\n",
1359 s, 1353 s,
1360 msg->easy_handle, 1354 msg->easy_handle,
1361 GNUNET_i2s (&s->target)); 1355 GNUNET_i2s (&s->address->peer));
1362 /* Disconnect other transmission direction and tell transport */ 1356 /* Disconnect other transmission direction and tell transport */
1363 s->get.easyhandle = NULL; 1357 s->get.easyhandle = NULL;
1364 s->get.s = NULL; 1358 s->get.s = NULL;
@@ -1595,7 +1589,7 @@ client_connect (struct Session *s)
1595 { 1589 {
1596 LOG (GNUNET_ERROR_TYPE_DEBUG, 1590 LOG (GNUNET_ERROR_TYPE_DEBUG,
1597 "Invalid address peer `%s'\n", 1591 "Invalid address peer `%s'\n",
1598 GNUNET_i2s (&s->target)); 1592 GNUNET_i2s (&s->address->peer));
1599 return GNUNET_SYSERR; 1593 return GNUNET_SYSERR;
1600 } 1594 }
1601 1595
@@ -1609,7 +1603,7 @@ client_connect (struct Session *s)
1609 plugin->last_tag++; 1603 plugin->last_tag++;
1610 LOG (GNUNET_ERROR_TYPE_DEBUG, 1604 LOG (GNUNET_ERROR_TYPE_DEBUG,
1611 "Initiating outbound session peer `%s' using address `%s'\n", 1605 "Initiating outbound session peer `%s' using address `%s'\n",
1612 GNUNET_i2s (&s->target), s->url); 1606 GNUNET_i2s (&s->address->peer), s->url);
1613 1607
1614 if ((GNUNET_SYSERR == client_connect_get (s)) || 1608 if ((GNUNET_SYSERR == client_connect_get (s)) ||
1615 (GNUNET_SYSERR == client_connect_put (s))) 1609 (GNUNET_SYSERR == client_connect_put (s)))
@@ -1757,7 +1751,6 @@ http_client_plugin_get_session (void *cls,
1757 } 1751 }
1758 1752
1759 s = GNUNET_new (struct Session); 1753 s = GNUNET_new (struct Session);
1760 s->target = address->peer;
1761 s->plugin = plugin; 1754 s->plugin = plugin;
1762 s->address = GNUNET_HELLO_address_copy (address); 1755 s->address = GNUNET_HELLO_address_copy (address);
1763 s->ats_address_network_type = ats.value; 1756 s->ats_address_network_type = ats.value;
@@ -1774,11 +1767,11 @@ http_client_plugin_get_session (void *cls,
1774 http_common_plugin_address_to_string (plugin->protocol, 1767 http_common_plugin_address_to_string (plugin->protocol,
1775 s->address->address, 1768 s->address->address,
1776 s->address->address_length), 1769 s->address->address_length),
1777 GNUNET_i2s (&s->target)); 1770 GNUNET_i2s (&s->address->peer));
1778 1771
1779 /* add new session */ 1772 /* add new session */
1780 (void) GNUNET_CONTAINER_multipeermap_put (plugin->sessions, 1773 (void) GNUNET_CONTAINER_multipeermap_put (plugin->sessions,
1781 &s->target, 1774 &s->address->peer,
1782 s, 1775 s,
1783 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE); 1776 GNUNET_CONTAINER_MULTIHASHMAPOPTION_MULTIPLE);
1784 /* initiate new connection */ 1777 /* initiate new connection */
@@ -1789,7 +1782,7 @@ http_client_plugin_get_session (void *cls,
1789 http_common_plugin_address_to_string (plugin->protocol, 1782 http_common_plugin_address_to_string (plugin->protocol,
1790 s->address->address, 1783 s->address->address,
1791 s->address->address_length), 1784 s->address->address_length),
1792 GNUNET_i2s (&s->target)); 1785 GNUNET_i2s (&s->address->peer));
1793 client_delete_session (s); 1786 client_delete_session (s);
1794 return NULL; 1787 return NULL;
1795 } 1788 }