diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-16 19:44:24 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2011-09-16 19:44:24 +0000 |
commit | 426be645faa129f78dc8484f8c596a7cb00549b2 (patch) | |
tree | 2f5361b83fc127139cdea3054ca7000919e9fff6 /src/transport/plugin_transport_http_client.c | |
parent | 261df49654bbd239d9d164177e1d362ed09f8411 (diff) | |
download | gnunet-426be645faa129f78dc8484f8c596a7cb00549b2.tar.gz gnunet-426be645faa129f78dc8484f8c596a7cb00549b2.zip |
sending and receiving implemented
Diffstat (limited to 'src/transport/plugin_transport_http_client.c')
-rw-r--r-- | src/transport/plugin_transport_http_client.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/src/transport/plugin_transport_http_client.c b/src/transport/plugin_transport_http_client.c index 3b3a4705b..224adb474 100644 --- a/src/transport/plugin_transport_http_client.c +++ b/src/transport/plugin_transport_http_client.c | |||
@@ -181,7 +181,7 @@ client_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
181 | { | 181 | { |
182 | #if DEBUG_HTTP | 182 | #if DEBUG_HTTP |
183 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 183 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
184 | "Connection to '%s' %s ended\n", GNUNET_i2s(&s->target), http_plugin_address_to_string(plugin, s->addr, s->addrlen)); | 184 | "Connection to '%s' %s ended\n", GNUNET_i2s(&s->target), GNUNET_a2s (s->addr, s->addrlen)); |
185 | #endif | 185 | #endif |
186 | client_disconnect(s); | 186 | client_disconnect(s); |
187 | //GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,"Notifying about ended session to peer `%s' `%s'\n", GNUNET_i2s (&s->target), http_plugin_address_to_string (plugin, s->addr, s->addrlen)); | 187 | //GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,"Notifying about ended session to peer `%s' `%s'\n", GNUNET_i2s (&s->target), http_plugin_address_to_string (plugin, s->addr, s->addrlen)); |
@@ -206,9 +206,9 @@ client_disconnect (struct Session *s) | |||
206 | struct HTTP_Message * msg; | 206 | struct HTTP_Message * msg; |
207 | struct HTTP_Message * t; | 207 | struct HTTP_Message * t; |
208 | 208 | ||
209 | #if 0 | 209 | #if DEBUG_HTTP |
210 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 210 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
211 | "Deleting outbound PUT session to peer `%s'\n", | 211 | "Client: Deleting outbound PUT session to peer `%s'\n", |
212 | GNUNET_i2s (&s->target)); | 212 | GNUNET_i2s (&s->target)); |
213 | #endif | 213 | #endif |
214 | 214 | ||
@@ -227,7 +227,7 @@ client_disconnect (struct Session *s) | |||
227 | 227 | ||
228 | #if DEBUG_HTTP | 228 | #if DEBUG_HTTP |
229 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 229 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
230 | "Deleting outbound GET session to peer `%s'\n", | 230 | "Client: Deleting outbound GET session to peer `%s'\n", |
231 | GNUNET_i2s (&s->target)); | 231 | GNUNET_i2s (&s->target)); |
232 | #endif | 232 | #endif |
233 | 233 | ||
@@ -304,6 +304,12 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls) | |||
304 | struct Session *s = cls; | 304 | struct Session *s = cls; |
305 | struct Plugin *plugin = s->plugin; | 305 | struct Plugin *plugin = s->plugin; |
306 | 306 | ||
307 | #if VERBOSE_CLIENT | ||
308 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Client: Received %Zu bytes from peer `%s'\n", | ||
309 | size * nmemb, | ||
310 | GNUNET_i2s (&s->target)); | ||
311 | #endif | ||
312 | |||
307 | if (GNUNET_TIME_absolute_get().abs_value < s->delay.abs_value) | 313 | if (GNUNET_TIME_absolute_get().abs_value < s->delay.abs_value) |
308 | { | 314 | { |
309 | #if DEBUG_CLIENT | 315 | #if DEBUG_CLIENT |
@@ -314,17 +320,13 @@ client_receive (void *stream, size_t size, size_t nmemb, void *cls) | |||
314 | return 0; | 320 | return 0; |
315 | } | 321 | } |
316 | 322 | ||
323 | |||
317 | if (s->msg_tk == NULL) | 324 | if (s->msg_tk == NULL) |
318 | s->msg_tk = GNUNET_SERVER_mst_create (&client_receive_mst_cb, s); | 325 | s->msg_tk = GNUNET_SERVER_mst_create (&client_receive_mst_cb, s); |
319 | 326 | ||
320 | GNUNET_SERVER_mst_receive (s->msg_tk, s, stream, size * nmemb, GNUNET_NO, | 327 | GNUNET_SERVER_mst_receive (s->msg_tk, s, stream, size * nmemb, GNUNET_NO, |
321 | GNUNET_NO); | 328 | GNUNET_NO); |
322 | 329 | ||
323 | #if VERBOSE_CLIENT | ||
324 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, "Received %u bytes from peer `%s'\n", | ||
325 | size * nmemb, | ||
326 | GNUNET_i2s (&s->target)); | ||
327 | #endif | ||
328 | return (size * nmemb); | 330 | return (size * nmemb); |
329 | } | 331 | } |
330 | 332 | ||
@@ -389,9 +391,9 @@ client_send_cb (void *stream, size_t size, size_t nmemb, void *cls) | |||
389 | 391 | ||
390 | if (msg->pos == msg->size) | 392 | if (msg->pos == msg->size) |
391 | { | 393 | { |
392 | #if DEBUG_CONNECTIONS | 394 | #if VERBOSE_CLIENT |
393 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 395 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
394 | "Connection %X: Message with %u bytes sent, removing message from queue\n", | 396 | "Message with %u bytes sent, removing message from queue\n", |
395 | s, msg->pos); | 397 | s, msg->pos); |
396 | #endif | 398 | #endif |
397 | /* Calling transmit continuation */ | 399 | /* Calling transmit continuation */ |
@@ -422,6 +424,7 @@ client_connect (struct Session *s) | |||
422 | plugin->last_tag++; | 424 | plugin->last_tag++; |
423 | /* create url */ | 425 | /* create url */ |
424 | GNUNET_asprintf (&url, "%s%s;%u", http_plugin_address_to_string (plugin, s->addr, s->addrlen), GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),plugin->last_tag); | 426 | GNUNET_asprintf (&url, "%s%s;%u", http_plugin_address_to_string (plugin, s->addr, s->addrlen), GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),plugin->last_tag); |
427 | //GNUNET_asprintf (&url, "http://www.heise.de", http_plugin_address_to_string (plugin, s->addr, s->addrlen), GNUNET_h2s_full (&plugin->env->my_identity->hashPubKey),plugin->last_tag); | ||
425 | #if 0 | 428 | #if 0 |
426 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 429 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, |
427 | "URL `%s'\n", | 430 | "URL `%s'\n", |