diff options
author | Christian Grothoff <christian@grothoff.org> | 2014-06-23 17:49:20 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2014-06-23 17:49:20 +0000 |
commit | 252aa2534e470ace72364a65f13bed5bf07cc908 (patch) | |
tree | 6161d5e7b1b14f95429f921e0dbd4a95cccb033e /src/transport/plugin_transport_http_client.c | |
parent | f64dd0f4f8b31ca939519efaab5cb001ee76cb1f (diff) | |
download | gnunet-252aa2534e470ace72364a65f13bed5bf07cc908.tar.gz gnunet-252aa2534e470ace72364a65f13bed5bf07cc908.zip |
-remove logic for somewhat overkill check to see if session object is valid
Diffstat (limited to 'src/transport/plugin_transport_http_client.c')
-rw-r--r-- | src/transport/plugin_transport_http_client.c | 77 |
1 files changed, 14 insertions, 63 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index f70393595..835df7cfc 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -182,6 +182,7 @@ struct Session | |||
182 | * Client receive handle | 182 | * Client receive handle |
183 | */ | 183 | */ |
184 | void *client_get; | 184 | void *client_get; |
185 | |||
185 | /** | 186 | /** |
186 | * next pointer for double linked list | 187 | * next pointer for double linked list |
187 | */ | 188 | */ |
@@ -219,12 +220,22 @@ struct Session | |||
219 | struct GNUNET_TIME_Absolute next_receive; | 220 | struct GNUNET_TIME_Absolute next_receive; |
220 | 221 | ||
221 | /** | 222 | /** |
223 | * Number of bytes waiting for transmission to this peer. | ||
224 | */ | ||
225 | unsigned long long bytes_in_queue; | ||
226 | |||
227 | /** | ||
222 | * Outbound overhead due to HTTP connection | 228 | * Outbound overhead due to HTTP connection |
223 | * Add to next message of this session when calling callback | 229 | * Add to next message of this session when calling callback |
224 | */ | 230 | */ |
225 | size_t overhead; | 231 | size_t overhead; |
226 | 232 | ||
227 | /** | 233 | /** |
234 | * Number of messages waiting for transmission to this peer. | ||
235 | */ | ||
236 | unsigned int msgs_in_queue; | ||
237 | |||
238 | /** | ||
228 | * ATS network type in NBO | 239 | * ATS network type in NBO |
229 | */ | 240 | */ |
230 | uint32_t ats_address_network_type; | 241 | uint32_t ats_address_network_type; |
@@ -390,26 +401,6 @@ client_connect_put (struct Session *s); | |||
390 | 401 | ||
391 | 402 | ||
392 | /** | 403 | /** |
393 | * Does a session s exists? | ||
394 | * | ||
395 | * @param plugin the plugin | ||
396 | * @param s desired session | ||
397 | * @return #GNUNET_YES or #GNUNET_NO | ||
398 | */ | ||
399 | static int | ||
400 | client_exist_session (struct HTTP_Client_Plugin *plugin, | ||
401 | struct Session *s) | ||
402 | { | ||
403 | struct Session * head; | ||
404 | |||
405 | for (head = plugin->head; head != NULL; head = head->next) | ||
406 | if (head == s) | ||
407 | return GNUNET_YES; | ||
408 | return GNUNET_NO; | ||
409 | } | ||
410 | |||
411 | |||
412 | /** | ||
413 | * Loggging function | 404 | * Loggging function |
414 | * | 405 | * |
415 | * @param curl the curl easy handle | 406 | * @param curl the curl easy handle |
@@ -512,13 +503,6 @@ http_client_plugin_send (void *cls, | |||
512 | struct HTTP_Message *msg; | 503 | struct HTTP_Message *msg; |
513 | char *stat_txt; | 504 | char *stat_txt; |
514 | 505 | ||
515 | /* lookup if session is really existing */ | ||
516 | if (GNUNET_YES != client_exist_session (plugin, s)) | ||
517 | { | ||
518 | GNUNET_break (0); | ||
519 | return GNUNET_SYSERR; | ||
520 | } | ||
521 | |||
522 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 506 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
523 | "Session %p/connection %p: Sending message with %u to peer `%s' \n", | 507 | "Session %p/connection %p: Sending message with %u to peer `%s' \n", |
524 | s, s->client_put, | 508 | s, s->client_put, |
@@ -649,12 +633,6 @@ http_client_session_disconnect (void *cls, | |||
649 | int res = GNUNET_OK; | 633 | int res = GNUNET_OK; |
650 | CURLMcode mret; | 634 | CURLMcode mret; |
651 | 635 | ||
652 | if (GNUNET_YES != client_exist_session (plugin, s)) | ||
653 | { | ||
654 | GNUNET_break (0); | ||
655 | return GNUNET_SYSERR; | ||
656 | } | ||
657 | |||
658 | if (NULL != s->client_put) | 636 | if (NULL != s->client_put) |
659 | { | 637 | { |
660 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 638 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -852,17 +830,13 @@ client_send_cb (void *stream, | |||
852 | size_t len; | 830 | size_t len; |
853 | char *stat_txt; | 831 | char *stat_txt; |
854 | 832 | ||
855 | if (GNUNET_YES != client_exist_session (plugin, s)) | ||
856 | { | ||
857 | GNUNET_break (0); | ||
858 | return 0; | ||
859 | } | ||
860 | if (GNUNET_YES == s->put_tmp_disconnecting) | 833 | if (GNUNET_YES == s->put_tmp_disconnecting) |
861 | { | 834 | { |
862 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 835 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
863 | "Session %p/connection %p: disconnect due to inactivity\n", | 836 | "Session %p/connection %p: disconnect due to inactivity\n", |
864 | s, s->client_put); | 837 | s, |
865 | return 0; | 838 | s->client_put); |
839 | return 0; | ||
866 | } | 840 | } |
867 | 841 | ||
868 | if (NULL == msg) | 842 | if (NULL == msg) |
@@ -921,11 +895,6 @@ client_wake_up (void *cls, | |||
921 | struct Session *s = cls; | 895 | struct Session *s = cls; |
922 | struct HTTP_Client_Plugin *p = s->plugin; | 896 | struct HTTP_Client_Plugin *p = s->plugin; |
923 | 897 | ||
924 | if (GNUNET_YES != client_exist_session (p, s)) | ||
925 | { | ||
926 | GNUNET_break (0); | ||
927 | return; | ||
928 | } | ||
929 | s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK; | 898 | s->recv_wakeup_task = GNUNET_SCHEDULER_NO_TASK; |
930 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 899 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
931 | return; | 900 | return; |
@@ -959,12 +928,6 @@ client_receive_mst_cb (void *cls, void *client, | |||
959 | char *stat_txt; | 928 | char *stat_txt; |
960 | 929 | ||
961 | plugin = s->plugin; | 930 | plugin = s->plugin; |
962 | if (GNUNET_YES != client_exist_session (plugin, s)) | ||
963 | { | ||
964 | GNUNET_break (0); | ||
965 | return GNUNET_OK; | ||
966 | } | ||
967 | |||
968 | atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE); | 931 | atsi.type = htonl (GNUNET_ATS_NETWORK_TYPE); |
969 | atsi.value = s->ats_address_network_type; | 932 | atsi.value = s->ats_address_network_type; |
970 | GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED)); | 933 | GNUNET_break (s->ats_address_network_type != ntohl (GNUNET_ATS_NET_UNSPECIFIED)); |
@@ -1194,13 +1157,6 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1194 | GNUNET_assert (CURLE_OK == | 1157 | GNUNET_assert (CURLE_OK == |
1195 | curl_easy_getinfo (easy_h, CURLINFO_PRIVATE, &d)); | 1158 | curl_easy_getinfo (easy_h, CURLINFO_PRIVATE, &d)); |
1196 | s = (struct Session *) d; | 1159 | s = (struct Session *) d; |
1197 | |||
1198 | if (GNUNET_YES != client_exist_session(plugin, s)) | ||
1199 | { | ||
1200 | GNUNET_break (0); | ||
1201 | return; | ||
1202 | } | ||
1203 | |||
1204 | GNUNET_assert (s != NULL); | 1160 | GNUNET_assert (s != NULL); |
1205 | if (msg->msg == CURLMSG_DONE) | 1161 | if (msg->msg == CURLMSG_DONE) |
1206 | { | 1162 | { |
@@ -1939,11 +1895,6 @@ http_client_plugin_update_session_timeout (void *cls, | |||
1939 | struct HTTP_Client_Plugin *plugin = cls; | 1895 | struct HTTP_Client_Plugin *plugin = cls; |
1940 | 1896 | ||
1941 | /* lookup if session is really existing */ | 1897 | /* lookup if session is really existing */ |
1942 | if (GNUNET_YES != client_exist_session (plugin, session)) | ||
1943 | { | ||
1944 | GNUNET_break (0); | ||
1945 | return; | ||
1946 | } | ||
1947 | client_reschedule_session_timeout (session); | 1898 | client_reschedule_session_timeout (session); |
1948 | } | 1899 | } |
1949 | 1900 | ||