aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_http_server.c
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2012-09-18 11:08:57 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2012-09-18 11:08:57 +0000
commite5d90281a1b8b9d91e4ea754bc7831cf56c4a0c9 (patch)
treef4a6a12fd8569b53b95964b6902b4caa963a9701 /src/transport/plugin_transport_http_server.c
parentd97fd0c17f23c6d74e8ec09871e9fa58b4231783 (diff)
downloadgnunet-e5d90281a1b8b9d91e4ea754bc7831cf56c4a0c9.tar.gz
gnunet-e5d90281a1b8b9d91e4ea754bc7831cf56c4a0c9.zip
- changes to http
Diffstat (limited to 'src/transport/plugin_transport_http_server.c')
-rw-r--r--src/transport/plugin_transport_http_server.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c
index 6d4549f35..0f2cf7138 100644
--- a/src/transport/plugin_transport_http_server.c
+++ b/src/transport/plugin_transport_http_server.c
@@ -524,6 +524,11 @@ http_server_plugin_send (void *cls,
524 if (GNUNET_YES == session->server_send->disconnect) 524 if (GNUNET_YES == session->server_send->disconnect)
525 return GNUNET_SYSERR; 525 return GNUNET_SYSERR;
526 526
527 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, session->plugin->name,
528 "Session %p/connection %p: Sending message with %u to peer `%s' with \n",
529 session, session->server_send,
530 msgbuf_size, GNUNET_i2s (&session->target));
531
527 /* create new message and schedule */ 532 /* create new message and schedule */
528 bytes_sent = sizeof (struct HTTP_Message) + msgbuf_size; 533 bytes_sent = sizeof (struct HTTP_Message) + msgbuf_size;
529 msg = GNUNET_malloc (bytes_sent); 534 msg = GNUNET_malloc (bytes_sent);
@@ -1167,7 +1172,8 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max)
1167 GNUNET_free (msg); 1172 GNUNET_free (msg);
1168 } 1173 }
1169 } 1174 }
1170 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, 1175 if (0 < bytes_read)
1176 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name,
1171 "Sent %u bytes to peer `%s' with session %p \n", bytes_read, GNUNET_i2s (&s->target), s); 1177 "Sent %u bytes to peer `%s' with session %p \n", bytes_read, GNUNET_i2s (&s->target), s);
1172 return bytes_read; 1178 return bytes_read;
1173} 1179}
@@ -1248,10 +1254,10 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1248 struct MHD_Response *response; 1254 struct MHD_Response *response;
1249 1255
1250 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1256 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1251 _("Access from connection %p (%u of %u) for %s %s url `%s' \n"), 1257 _("Access from connection %p (%u of %u) for `%s' `%s' url `%s' with upload data size %u\n"),
1252 sc, 1258 sc,
1253 plugin->cur_connections, plugin->max_connections, 1259 plugin->cur_connections, plugin->max_connections,
1254 method, version, url); 1260 method, version, url, (*upload_data_size));
1255 1261
1256 GNUNET_assert (cls != NULL); 1262 GNUNET_assert (cls != NULL);
1257 if (sc == NULL) 1263 if (sc == NULL)
@@ -1259,7 +1265,9 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1259 /* new connection */ 1265 /* new connection */
1260 sc = server_lookup_connection (plugin, mhd_connection, url, method); 1266 sc = server_lookup_connection (plugin, mhd_connection, url, method);
1261 if (sc != NULL) 1267 if (sc != NULL)
1268 {
1262 (*httpSessionCache) = sc; 1269 (*httpSessionCache) = sc;
1270 }
1263 else 1271 else
1264 { 1272 {
1265 response = MHD_create_response_from_data (strlen (HTTP_ERROR_RESPONSE), HTTP_ERROR_RESPONSE, MHD_NO, MHD_NO); 1273 response = MHD_create_response_from_data (strlen (HTTP_ERROR_RESPONSE), HTTP_ERROR_RESPONSE, MHD_NO, MHD_NO);
@@ -1281,7 +1289,6 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1281 /* existing connection */ 1289 /* existing connection */
1282 sc = (*httpSessionCache); 1290 sc = (*httpSessionCache);
1283 s = sc->session; 1291 s = sc->session;
1284
1285 GNUNET_assert (NULL != s); 1292 GNUNET_assert (NULL != s);
1286 /* connection is to be disconnected */ 1293 /* connection is to be disconnected */
1287 if (sc->disconnect == GNUNET_YES) 1294 if (sc->disconnect == GNUNET_YES)
@@ -1294,14 +1301,7 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1294 MHD_destroy_response (response); 1301 MHD_destroy_response (response);
1295 return MHD_YES; 1302 return MHD_YES;
1296 } 1303 }
1297
1298 GNUNET_assert (s != NULL); 1304 GNUNET_assert (s != NULL);
1299 /* Check if both directions are connected */
1300 if ((sc->session->server_recv == NULL) || (sc->session->server_send == NULL))
1301 {
1302 /* Delayed read from since not both semi-connections are connected */
1303 return MHD_YES;
1304 }
1305 1305
1306 if (sc->direction == _SEND) 1306 if (sc->direction == _SEND)
1307 { 1307 {
@@ -1319,7 +1319,8 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1319 { 1319 {
1320 /* (*upload_data_size == 0) first callback when header are passed */ 1320 /* (*upload_data_size == 0) first callback when header are passed */
1321 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1321 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1322 "Peer `%s' PUT on address `%s' connected\n", 1322 "Session %p / Connection %p: Peer `%s' PUT on address `%s' connected\n",
1323 s, sc,
1323 GNUNET_i2s (&s->target), 1324 GNUNET_i2s (&s->target),
1324 http_common_plugin_address_to_string (NULL, 1325 http_common_plugin_address_to_string (NULL,
1325 s->addr, 1326 s->addr,
@@ -1331,7 +1332,8 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1331 { 1332 {
1332 /* (*upload_data_size == 0) when upload is complete */ 1333 /* (*upload_data_size == 0) when upload is complete */
1333 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1334 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1334 "Peer `%s' PUT on address `%s' finished upload\n", 1335 "Session %p / Connection %p: Peer `%s' PUT on address `%s' finished upload\n",
1336 s, sc,
1335 GNUNET_i2s (&s->target), 1337 GNUNET_i2s (&s->target),
1336 http_common_plugin_address_to_string (NULL, 1338 http_common_plugin_address_to_string (NULL,
1337 s->addr, 1339 s->addr,
@@ -1349,7 +1351,8 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1349 { 1351 {
1350 /* (*upload_data_size > 0) for every segment received */ 1352 /* (*upload_data_size > 0) for every segment received */
1351 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, 1353 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name,
1352 "Peer `%s' PUT on address `%s' received %u bytes\n", 1354 "Session %p / Connection %p: Peer `%s' PUT on address `%s' received %u bytes\n",
1355 s, sc,
1353 GNUNET_i2s (&s->target), 1356 GNUNET_i2s (&s->target),
1354 http_common_plugin_address_to_string (NULL, 1357 http_common_plugin_address_to_string (NULL,
1355 s->addr, 1358 s->addr,
@@ -1376,8 +1379,8 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection,
1376 else 1379 else
1377 { 1380 {
1378 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, 1381 GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
1379 "%p no inbound bandwidth available! Next read was delayed by %llu ms\n", 1382 "Session %p / Connection %p: no inbound bandwidth available! Next read was delayed by %llu ms\n",
1380 s, now.abs_value - s->next_receive.abs_value); 1383 s, sc, now.abs_value - s->next_receive.abs_value);
1381 } 1384 }
1382 return MHD_YES; 1385 return MHD_YES;
1383 } 1386 }