diff options
Diffstat (limited to 'src/transport')
-rw-r--r-- | src/transport/plugin_transport_http_server.c | 639 |
1 files changed, 321 insertions, 318 deletions
diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 3d2ba2bfb..a45a25fbd 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c | |||
@@ -50,6 +50,9 @@ | |||
50 | #define _SEND 1 | 50 | #define _SEND 1 |
51 | 51 | ||
52 | 52 | ||
53 | #define LOG(kind,...) GNUNET_log_from (kind, "transport-" PLUGIN_NAME,__VA_ARGS__) | ||
54 | |||
55 | |||
53 | /** | 56 | /** |
54 | * Session handle for connections. | 57 | * Session handle for connections. |
55 | */ | 58 | */ |
@@ -550,10 +553,12 @@ http_server_plugin_send (void *cls, | |||
550 | return GNUNET_SYSERR; | 553 | return GNUNET_SYSERR; |
551 | 554 | ||
552 | 555 | ||
553 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, session->plugin->name, | 556 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
554 | "Session %p/connection %p: Sending message with %u to peer `%s' with \n", | 557 | "Session %p/connection %p: Sending message with %u to peer `%s'\n", |
555 | session, session->server_send, | 558 | session, |
556 | msgbuf_size, GNUNET_i2s (&session->target)); | 559 | session->server_send, |
560 | msgbuf_size, | ||
561 | GNUNET_i2s (&session->target)); | ||
557 | 562 | ||
558 | /* create new message and schedule */ | 563 | /* create new message and schedule */ |
559 | bytes_sent = sizeof (struct HTTP_Message) + msgbuf_size; | 564 | bytes_sent = sizeof (struct HTTP_Message) + msgbuf_size; |
@@ -599,18 +604,18 @@ http_server_plugin_disconnect_peer (void *cls, | |||
599 | struct Session *next; | 604 | struct Session *next; |
600 | struct Session *pos; | 605 | struct Session *pos; |
601 | 606 | ||
602 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 607 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
603 | "Transport tells me to disconnect `%s'\n", | 608 | "Transport tells me to disconnect `%s'\n", |
604 | GNUNET_i2s (target)); | 609 | GNUNET_i2s (target)); |
605 | next = plugin->head; | 610 | next = plugin->head; |
606 | while (NULL != (pos = next)) | 611 | while (NULL != (pos = next)) |
607 | { | 612 | { |
608 | next = pos->next; | 613 | next = pos->next; |
609 | if (0 == memcmp (target, &pos->target, sizeof (struct GNUNET_PeerIdentity))) | 614 | if (0 == memcmp (target, &pos->target, sizeof (struct GNUNET_PeerIdentity))) |
610 | { | 615 | { |
611 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 616 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
612 | "Disconnecting session %p to `%s'\n", | 617 | "Disconnecting session %p to `%s'\n", |
613 | pos, GNUNET_i2s (target)); | 618 | pos, GNUNET_i2s (target)); |
614 | http_server_plugin_disconnect_session (plugin, pos); | 619 | http_server_plugin_disconnect_session (plugin, pos); |
615 | } | 620 | } |
616 | } | 621 | } |
@@ -719,9 +724,9 @@ server_delete_session (void *cls, | |||
719 | GNUNET_HELLO_address_free (s->address); | 724 | GNUNET_HELLO_address_free (s->address); |
720 | GNUNET_free_non_null (s->server_recv); | 725 | GNUNET_free_non_null (s->server_recv); |
721 | GNUNET_free_non_null (s->server_send); | 726 | GNUNET_free_non_null (s->server_send); |
722 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 727 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
723 | plugin->name, | 728 | "Session %p destroyed\n", |
724 | "Session %p destroyed\n", s); | 729 | s); |
725 | GNUNET_free (s); | 730 | GNUNET_free (s); |
726 | return GNUNET_OK; | 731 | return GNUNET_OK; |
727 | } | 732 | } |
@@ -830,9 +835,9 @@ http_server_plugin_disconnect_session (void *cls, | |||
830 | send = (struct ServerConnection *) s->server_send; | 835 | send = (struct ServerConnection *) s->server_send; |
831 | if (send != NULL) | 836 | if (send != NULL) |
832 | { | 837 | { |
833 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, | 838 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
834 | "Server: %p / %p Terminating inbound PUT session to peer `%s'\n", | 839 | "Server: %p / %p Terminating inbound PUT session to peer `%s'\n", |
835 | s, send, GNUNET_i2s (&s->target)); | 840 | s, send, GNUNET_i2s (&s->target)); |
836 | 841 | ||
837 | MHD_set_connection_option (send->mhd_conn, | 842 | MHD_set_connection_option (send->mhd_conn, |
838 | MHD_CONNECTION_OPTION_TIMEOUT, | 843 | MHD_CONNECTION_OPTION_TIMEOUT, |
@@ -843,10 +848,9 @@ http_server_plugin_disconnect_session (void *cls, | |||
843 | recv = (struct ServerConnection *) s->server_recv; | 848 | recv = (struct ServerConnection *) s->server_recv; |
844 | if (recv != NULL) | 849 | if (recv != NULL) |
845 | { | 850 | { |
846 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, | 851 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
847 | "Server: %p / %p Terminating inbound GET session to peer `%s'\n", | 852 | "Server: %p / %p Terminating inbound GET session to peer `%s'\n", |
848 | s, recv, GNUNET_i2s (&s->target)); | 853 | s, recv, GNUNET_i2s (&s->target)); |
849 | |||
850 | MHD_set_connection_option (recv->mhd_conn, | 854 | MHD_set_connection_option (recv->mhd_conn, |
851 | MHD_CONNECTION_OPTION_TIMEOUT, | 855 | MHD_CONNECTION_OPTION_TIMEOUT, |
852 | 1); | 856 | 1); |
@@ -899,9 +903,9 @@ server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, | |||
899 | /* Setting timeouts for other connections */ | 903 | /* Setting timeouts for other connections */ |
900 | if (NULL != s->server_recv) | 904 | if (NULL != s->server_recv) |
901 | { | 905 | { |
902 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 906 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
903 | "Setting timeout for %p to %u sec.\n", | 907 | "Setting timeout for %p to %u sec.\n", |
904 | s->server_recv, to); | 908 | s->server_recv, to); |
905 | MHD_set_connection_option (s->server_recv->mhd_conn, | 909 | MHD_set_connection_option (s->server_recv->mhd_conn, |
906 | MHD_CONNECTION_OPTION_TIMEOUT, | 910 | MHD_CONNECTION_OPTION_TIMEOUT, |
907 | to); | 911 | to); |
@@ -909,9 +913,9 @@ server_mhd_connection_timeout (struct HTTP_Server_Plugin *plugin, | |||
909 | } | 913 | } |
910 | if (NULL != s->server_send) | 914 | if (NULL != s->server_send) |
911 | { | 915 | { |
912 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 916 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
913 | "Setting timeout for %p to %u sec.\n", | 917 | "Setting timeout for %p to %u sec.\n", |
914 | s->server_send, to); | 918 | s->server_send, to); |
915 | MHD_set_connection_option (s->server_send->mhd_conn, | 919 | MHD_set_connection_option (s->server_send->mhd_conn, |
916 | MHD_CONNECTION_OPTION_TIMEOUT, | 920 | MHD_CONNECTION_OPTION_TIMEOUT, |
917 | to); | 921 | to); |
@@ -957,9 +961,8 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, | |||
957 | 961 | ||
958 | if (regexec(&plugin->url_regex, url, 4, matches, 0)) | 962 | if (regexec(&plugin->url_regex, url, 4, matches, 0)) |
959 | { | 963 | { |
960 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 964 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
961 | plugin->name, | 965 | "URL `%s' did not match regex\n", url); |
962 | "URL `%s' did not match regex\n", url); | ||
963 | return GNUNET_SYSERR; | 966 | return GNUNET_SYSERR; |
964 | } | 967 | } |
965 | 968 | ||
@@ -970,45 +973,40 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, | |||
970 | rc = strtoul (tag_start, &tag_end, 10); | 973 | rc = strtoul (tag_start, &tag_end, 10); |
971 | if (&url[matches[2].rm_eo] != tag_end) | 974 | if (&url[matches[2].rm_eo] != tag_end) |
972 | { | 975 | { |
973 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 976 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
974 | "URL tag did not line up with submatch\n"); | 977 | "URL tag did not line up with submatch\n"); |
975 | return GNUNET_SYSERR; | 978 | return GNUNET_SYSERR; |
976 | } | 979 | } |
977 | if (rc == 0) | 980 | if (rc == 0) |
978 | { | 981 | { |
979 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 982 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
980 | plugin->name, | 983 | "URL tag is zero\n"); |
981 | "URL tag is zero\n"); | ||
982 | return GNUNET_SYSERR; | 984 | return GNUNET_SYSERR; |
983 | } | 985 | } |
984 | if ((rc == ULONG_MAX) && (ERANGE == errno)) | 986 | if ((rc == ULONG_MAX) && (ERANGE == errno)) |
985 | { | 987 | { |
986 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 988 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
987 | plugin->name, | 989 | "URL tag > ULONG_MAX\n"); |
988 | "URL tag > ULONG_MAX\n"); | ||
989 | return GNUNET_SYSERR; | 990 | return GNUNET_SYSERR; |
990 | } | 991 | } |
991 | if (rc > UINT32_MAX) | 992 | if (rc > UINT32_MAX) |
992 | { | 993 | { |
993 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 994 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
994 | plugin->name, | 995 | "URL tag > UINT32_MAX\n"); |
995 | "URL tag > UINT32_MAX\n"); | ||
996 | return GNUNET_SYSERR; | 996 | return GNUNET_SYSERR; |
997 | } | 997 | } |
998 | (*tag) = (uint32_t)rc; | 998 | (*tag) = (uint32_t)rc; |
999 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 999 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1000 | plugin->name, | 1000 | "Found tag `%u' in url\n", |
1001 | "Found tag `%u' in url\n", | 1001 | *tag); |
1002 | *tag); | ||
1003 | 1002 | ||
1004 | /* convert peer id */ | 1003 | /* convert peer id */ |
1005 | hash_length = matches[1].rm_eo - matches[1].rm_so; | 1004 | hash_length = matches[1].rm_eo - matches[1].rm_so; |
1006 | if (hash_length != plugin->peer_id_length) | 1005 | if (hash_length != plugin->peer_id_length) |
1007 | { | 1006 | { |
1008 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 1007 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1009 | plugin->name, | 1008 | "URL target is %u bytes, expecting %u\n", |
1010 | "URL target is %u bytes, expecting %u\n", | 1009 | hash_length, plugin->peer_id_length); |
1011 | hash_length, plugin->peer_id_length); | ||
1012 | return GNUNET_SYSERR; | 1010 | return GNUNET_SYSERR; |
1013 | } | 1011 | } |
1014 | if (GNUNET_OK != | 1012 | if (GNUNET_OK != |
@@ -1016,14 +1014,13 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, | |||
1016 | hash_length, | 1014 | hash_length, |
1017 | &target->public_key)) | 1015 | &target->public_key)) |
1018 | { | 1016 | { |
1019 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1017 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1020 | "URL target conversion failed\n"); | 1018 | "URL target conversion failed\n"); |
1021 | return GNUNET_SYSERR; | 1019 | return GNUNET_SYSERR; |
1022 | } | 1020 | } |
1023 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | 1021 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1024 | plugin->name, | 1022 | "Found target `%s' in URL\n", |
1025 | "Found target `%s' in URL\n", | 1023 | GNUNET_i2s_full (target)); |
1026 | GNUNET_i2s_full (target)); | ||
1027 | 1024 | ||
1028 | /* convert options */ | 1025 | /* convert options */ |
1029 | if (-1 == matches[3].rm_so) { | 1026 | if (-1 == matches[3].rm_so) { |
@@ -1032,25 +1029,25 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, | |||
1032 | rc = strtoul (&url[matches[3].rm_so + 1], &options_end, 10); | 1029 | rc = strtoul (&url[matches[3].rm_so + 1], &options_end, 10); |
1033 | if (&url[matches[3].rm_eo] != options_end) | 1030 | if (&url[matches[3].rm_eo] != options_end) |
1034 | { | 1031 | { |
1035 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1032 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1036 | "URL options did not line up with submatch\n"); | 1033 | "URL options did not line up with submatch\n"); |
1037 | return GNUNET_SYSERR; | 1034 | return GNUNET_SYSERR; |
1038 | } | 1035 | } |
1039 | if ((rc == ULONG_MAX) && (ERANGE == errno)) | 1036 | if ((rc == ULONG_MAX) && (ERANGE == errno)) |
1040 | { | 1037 | { |
1041 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1038 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1042 | "URL options > ULONG_MAX\n"); | 1039 | "URL options > ULONG_MAX\n"); |
1043 | return GNUNET_SYSERR; | 1040 | return GNUNET_SYSERR; |
1044 | } | 1041 | } |
1045 | if (rc > UINT32_MAX) | 1042 | if (rc > UINT32_MAX) |
1046 | { | 1043 | { |
1047 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1044 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1048 | "URL options > UINT32_MAX\n"); | 1045 | "URL options > UINT32_MAX\n"); |
1049 | return GNUNET_SYSERR; | 1046 | return GNUNET_SYSERR; |
1050 | } | 1047 | } |
1051 | (*options) = (uint32_t)rc; | 1048 | (*options) = (uint32_t)rc; |
1052 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1049 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1053 | "Found options `%u' in url\n", *options); | 1050 | "Found options `%u' in url\n", *options); |
1054 | } | 1051 | } |
1055 | return GNUNET_OK; | 1052 | return GNUNET_OK; |
1056 | } | 1053 | } |
@@ -1088,14 +1085,16 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, | |||
1088 | if ((conn_info->client_addr->sa_family != AF_INET) && | 1085 | if ((conn_info->client_addr->sa_family != AF_INET) && |
1089 | (conn_info->client_addr->sa_family != AF_INET6)) | 1086 | (conn_info->client_addr->sa_family != AF_INET6)) |
1090 | return NULL; | 1087 | return NULL; |
1091 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1088 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1092 | "New %s connection from %s\n", method, url); | 1089 | "New %s connection from %s\n", |
1090 | method, | ||
1091 | url); | ||
1093 | 1092 | ||
1094 | if (GNUNET_SYSERR == server_parse_url (plugin, url, &target, &tag, &options)) | 1093 | if (GNUNET_SYSERR == server_parse_url (plugin, url, &target, &tag, &options)) |
1095 | { | 1094 | { |
1096 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1095 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1097 | "Invalid url %s\n", url); | 1096 | "Invalid url %s\n", url); |
1098 | return NULL; | 1097 | return NULL; |
1099 | } | 1098 | } |
1100 | if (0 == strcmp (MHD_HTTP_METHOD_PUT, method)) | 1099 | if (0 == strcmp (MHD_HTTP_METHOD_PUT, method)) |
1101 | direction = _RECEIVE; | 1100 | direction = _RECEIVE; |
@@ -1103,17 +1102,18 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, | |||
1103 | direction = _SEND; | 1102 | direction = _SEND; |
1104 | else | 1103 | else |
1105 | { | 1104 | { |
1106 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1105 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1107 | "Invalid method %s connection from %s\n", method, url); | 1106 | "Invalid method %s connection from %s\n", |
1107 | method, url); | ||
1108 | return NULL; | 1108 | return NULL; |
1109 | } | 1109 | } |
1110 | 1110 | ||
1111 | plugin->cur_connections++; | 1111 | plugin->cur_connections++; |
1112 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1112 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1113 | "New %s connection from %s with tag %u (%u of %u)\n", | 1113 | "New %s connection from %s with tag %u (%u of %u)\n", |
1114 | method, | 1114 | method, |
1115 | GNUNET_i2s (&target), tag, | 1115 | GNUNET_i2s (&target), tag, |
1116 | plugin->cur_connections, plugin->max_connections); | 1116 | plugin->cur_connections, plugin->max_connections); |
1117 | /* find duplicate session */ | 1117 | /* find duplicate session */ |
1118 | s = plugin->head; | 1118 | s = plugin->head; |
1119 | while (s != NULL) | 1119 | while (s != NULL) |
@@ -1127,20 +1127,19 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, | |||
1127 | { | 1127 | { |
1128 | if ((_RECEIVE == direction) && (NULL != s->server_recv)) | 1128 | if ((_RECEIVE == direction) && (NULL != s->server_recv)) |
1129 | { | 1129 | { |
1130 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1130 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1131 | "Duplicate PUT connection from `%s' tag %u, dismissing new connection\n", | 1131 | "Duplicate PUT connection from `%s' tag %u, dismissing new connection\n", |
1132 | GNUNET_i2s (&target), | 1132 | GNUNET_i2s (&target), |
1133 | tag); | 1133 | tag); |
1134 | return NULL; | 1134 | return NULL; |
1135 | |||
1136 | } | 1135 | } |
1137 | if ((_SEND == direction) && (NULL != s->server_send)) | 1136 | if ((_SEND == direction) && (NULL != s->server_send)) |
1138 | { | 1137 | { |
1139 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1138 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1140 | "Duplicate GET connection from `%s' tag %u, dismissing new connection\n", | 1139 | "Duplicate GET connection from `%s' tag %u, dismissing new connection\n", |
1141 | GNUNET_i2s (&target), | 1140 | GNUNET_i2s (&target), |
1142 | tag); | 1141 | tag); |
1143 | return NULL; | 1142 | return NULL; |
1144 | } | 1143 | } |
1145 | } | 1144 | } |
1146 | else | 1145 | else |
@@ -1181,12 +1180,12 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, | |||
1181 | server_start_session_timeout(s); | 1180 | server_start_session_timeout(s); |
1182 | GNUNET_CONTAINER_DLL_insert (plugin->head, plugin->tail, s); | 1181 | GNUNET_CONTAINER_DLL_insert (plugin->head, plugin->tail, s); |
1183 | 1182 | ||
1184 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1183 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1185 | "Creating new session %p for peer `%s' connecting from `%s'\n", | 1184 | "Creating new session %p for peer `%s' connecting from `%s'\n", |
1186 | s, GNUNET_i2s (&target), | 1185 | s, GNUNET_i2s (&target), |
1187 | http_common_plugin_address_to_string (NULL, | 1186 | http_common_plugin_address_to_string (NULL, |
1188 | plugin->protocol, | 1187 | plugin->protocol, |
1189 | addr, addr_len)); | 1188 | addr, addr_len)); |
1190 | GNUNET_free_non_null (addr); | 1189 | GNUNET_free_non_null (addr); |
1191 | } | 1190 | } |
1192 | sc = GNUNET_new (struct ServerConnection); | 1191 | sc = GNUNET_new (struct ServerConnection); |
@@ -1218,15 +1217,15 @@ server_lookup_connection (struct HTTP_Server_Plugin *plugin, | |||
1218 | } | 1217 | } |
1219 | else | 1218 | else |
1220 | { | 1219 | { |
1221 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1220 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1222 | "Session %p for peer `%s' fully connected\n", | 1221 | "Session %p for peer `%s' fully connected\n", |
1223 | s, GNUNET_i2s (&target)); | 1222 | s, GNUNET_i2s (&target)); |
1224 | to = (HTTP_SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL); | 1223 | to = (HTTP_SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL); |
1225 | server_mhd_connection_timeout (plugin, s, to); | 1224 | server_mhd_connection_timeout (plugin, s, to); |
1226 | } | 1225 | } |
1227 | 1226 | ||
1228 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1227 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1229 | "Setting timeout for %p to %u sec.\n", sc, to); | 1228 | "Setting timeout for %p to %u sec.\n", sc, to); |
1230 | return sc; | 1229 | return sc; |
1231 | } | 1230 | } |
1232 | 1231 | ||
@@ -1309,8 +1308,9 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max) | |||
1309 | if (0 < bytes_read) | 1308 | if (0 < bytes_read) |
1310 | { | 1309 | { |
1311 | sc->connected = GNUNET_YES; | 1310 | sc->connected = GNUNET_YES; |
1312 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, | 1311 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1313 | "Sent %u bytes to peer `%s' with session %p \n", bytes_read, GNUNET_i2s (&s->target), s); | 1312 | "Sent %u bytes to peer `%s' with session %p \n", |
1313 | bytes_read, GNUNET_i2s (&s->target), s); | ||
1314 | GNUNET_asprintf (&stat_txt, "# bytes currently in %s_server buffers", | 1314 | GNUNET_asprintf (&stat_txt, "# bytes currently in %s_server buffers", |
1315 | s->plugin->protocol); | 1315 | s->plugin->protocol); |
1316 | GNUNET_STATISTICS_update (s->plugin->env->stats, | 1316 | GNUNET_STATISTICS_update (s->plugin->env->stats, |
@@ -1321,10 +1321,12 @@ server_send_callback (void *cls, uint64_t pos, char *buf, size_t max) | |||
1321 | GNUNET_STATISTICS_update (s->plugin->env->stats, | 1321 | GNUNET_STATISTICS_update (s->plugin->env->stats, |
1322 | stat_txt, bytes_read, GNUNET_NO); | 1322 | stat_txt, bytes_read, GNUNET_NO); |
1323 | GNUNET_free (stat_txt); | 1323 | GNUNET_free (stat_txt); |
1324 | } else if ((sc->options & OPTION_LONG_POLL) && sc->connected) { | 1324 | } |
1325 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, s->plugin->name, | 1325 | else if ((sc->options & OPTION_LONG_POLL) && sc->connected) |
1326 | "Completing GET response to peer `%s' with session %p \n", | 1326 | { |
1327 | GNUNET_i2s (&s->target), s); | 1327 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1328 | "Completing GET response to peer `%s' with session %p \n", | ||
1329 | GNUNET_i2s (&s->target), s); | ||
1328 | return MHD_CONTENT_READER_END_OF_STREAM; | 1330 | return MHD_CONTENT_READER_END_OF_STREAM; |
1329 | } | 1331 | } |
1330 | return bytes_read; | 1332 | return bytes_read; |
@@ -1369,14 +1371,14 @@ server_receive_mst_cb (void *cls, void *client, | |||
1369 | s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); | 1371 | s->next_receive = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), delay); |
1370 | if (delay.rel_value_us > 0) | 1372 | if (delay.rel_value_us > 0) |
1371 | { | 1373 | { |
1372 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1374 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1373 | "Peer `%s' address `%s' next read delayed for %s\n", | 1375 | "Peer `%s' address `%s' next read delayed for %s\n", |
1374 | GNUNET_i2s (&s->target), | 1376 | GNUNET_i2s (&s->target), |
1375 | http_common_plugin_address_to_string (NULL, | 1377 | http_common_plugin_address_to_string (NULL, |
1376 | plugin->protocol, s->address->address, | 1378 | plugin->protocol, s->address->address, |
1377 | s->address->address_length), | 1379 | s->address->address_length), |
1378 | GNUNET_STRINGS_relative_time_to_string (delay, | 1380 | GNUNET_STRINGS_relative_time_to_string (delay, |
1379 | GNUNET_YES)); | 1381 | GNUNET_YES)); |
1380 | } | 1382 | } |
1381 | server_reschedule_session_timeout (s); | 1383 | server_reschedule_session_timeout (s); |
1382 | return GNUNET_OK; | 1384 | return GNUNET_OK; |
@@ -1426,11 +1428,11 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection, | |||
1426 | struct Session *s; | 1428 | struct Session *s; |
1427 | struct MHD_Response *response; | 1429 | struct MHD_Response *response; |
1428 | 1430 | ||
1429 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1431 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1430 | _("Access from connection %p (%u of %u) for `%s' `%s' url `%s' with upload data size %u\n"), | 1432 | _("Access from connection %p (%u of %u) for `%s' `%s' url `%s' with upload data size %u\n"), |
1431 | sc, | 1433 | sc, |
1432 | plugin->cur_connections, plugin->max_connections, | 1434 | plugin->cur_connections, plugin->max_connections, |
1433 | method, version, url, (*upload_data_size)); | 1435 | method, version, url, (*upload_data_size)); |
1434 | 1436 | ||
1435 | GNUNET_assert (cls != NULL); | 1437 | GNUNET_assert (cls != NULL); |
1436 | if (sc == NULL) | 1438 | if (sc == NULL) |
@@ -1507,26 +1509,26 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection, | |||
1507 | if ((*upload_data_size == 0) && (sc->connected == GNUNET_NO)) | 1509 | if ((*upload_data_size == 0) && (sc->connected == GNUNET_NO)) |
1508 | { | 1510 | { |
1509 | /* (*upload_data_size == 0) first callback when header are passed */ | 1511 | /* (*upload_data_size == 0) first callback when header are passed */ |
1510 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1512 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1511 | "Session %p / Connection %p: Peer `%s' PUT on address `%s' connected\n", | 1513 | "Session %p / Connection %p: Peer `%s' PUT on address `%s' connected\n", |
1512 | s, sc, | 1514 | s, sc, |
1513 | GNUNET_i2s (&s->target), | 1515 | GNUNET_i2s (&s->target), |
1514 | http_common_plugin_address_to_string (NULL, | 1516 | http_common_plugin_address_to_string (NULL, |
1515 | plugin->protocol, s->address->address, | 1517 | plugin->protocol, s->address->address, |
1516 | s->address->address_length)); | 1518 | s->address->address_length)); |
1517 | sc->connected = GNUNET_YES; | 1519 | sc->connected = GNUNET_YES; |
1518 | return MHD_YES; | 1520 | return MHD_YES; |
1519 | } | 1521 | } |
1520 | else if ((*upload_data_size == 0) && (sc->connected == GNUNET_YES)) | 1522 | else if ((*upload_data_size == 0) && (sc->connected == GNUNET_YES)) |
1521 | { | 1523 | { |
1522 | /* (*upload_data_size == 0) when upload is complete */ | 1524 | /* (*upload_data_size == 0) when upload is complete */ |
1523 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1525 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1524 | "Session %p / Connection %p: Peer `%s' PUT on address `%s' finished upload\n", | 1526 | "Session %p / Connection %p: Peer `%s' PUT on address `%s' finished upload\n", |
1525 | s, sc, | 1527 | s, sc, |
1526 | GNUNET_i2s (&s->target), | 1528 | GNUNET_i2s (&s->target), |
1527 | http_common_plugin_address_to_string (NULL, | 1529 | http_common_plugin_address_to_string (NULL, |
1528 | plugin->protocol, s->address->address, | 1530 | plugin->protocol, s->address->address, |
1529 | s->address->address_length)); | 1531 | s->address->address_length)); |
1530 | sc->connected = GNUNET_NO; | 1532 | sc->connected = GNUNET_NO; |
1531 | /* Sent HTTP/1.1: 200 OK as PUT Response\ */ | 1533 | /* Sent HTTP/1.1: 200 OK as PUT Response\ */ |
1532 | response = MHD_create_response_from_data (strlen ("Thank you!"), | 1534 | response = MHD_create_response_from_data (strlen ("Thank you!"), |
@@ -1540,21 +1542,21 @@ server_access_cb (void *cls, struct MHD_Connection *mhd_connection, | |||
1540 | else if ((*upload_data_size > 0) && (sc->connected == GNUNET_YES)) | 1542 | else if ((*upload_data_size > 0) && (sc->connected == GNUNET_YES)) |
1541 | { | 1543 | { |
1542 | /* (*upload_data_size > 0) for every segment received */ | 1544 | /* (*upload_data_size > 0) for every segment received */ |
1543 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1545 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1544 | "Session %p / Connection %p: Peer `%s' PUT on address `%s' received %u bytes\n", | 1546 | "Session %p / Connection %p: Peer `%s' PUT on address `%s' received %u bytes\n", |
1545 | s, sc, | 1547 | s, sc, |
1546 | GNUNET_i2s (&s->target), | 1548 | GNUNET_i2s (&s->target), |
1547 | http_common_plugin_address_to_string (NULL, | 1549 | http_common_plugin_address_to_string (NULL, |
1548 | plugin->protocol, s->address->address, | 1550 | plugin->protocol, s->address->address, |
1549 | s->address->address_length), | 1551 | s->address->address_length), |
1550 | *upload_data_size); | 1552 | *upload_data_size); |
1551 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); | 1553 | struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get (); |
1552 | 1554 | ||
1553 | if ((s->next_receive.abs_value_us <= now.abs_value_us)) | 1555 | if ((s->next_receive.abs_value_us <= now.abs_value_us)) |
1554 | { | 1556 | { |
1555 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1557 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1556 | "PUT with %u bytes forwarded to MST\n", | 1558 | "PUT with %u bytes forwarded to MST\n", |
1557 | *upload_data_size); | 1559 | *upload_data_size); |
1558 | if (s->msg_tk == NULL) | 1560 | if (s->msg_tk == NULL) |
1559 | { | 1561 | { |
1560 | s->msg_tk = GNUNET_SERVER_mst_create (&server_receive_mst_cb, s); | 1562 | s->msg_tk = GNUNET_SERVER_mst_create (&server_receive_mst_cb, s); |
@@ -1598,13 +1600,12 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection, | |||
1598 | { | 1600 | { |
1599 | struct HTTP_Server_Plugin *plugin = cls; | 1601 | struct HTTP_Server_Plugin *plugin = cls; |
1600 | struct ServerConnection *sc = *httpSessionCache; | 1602 | struct ServerConnection *sc = *httpSessionCache; |
1601 | struct Session *s = NULL; | 1603 | struct Session *s; |
1602 | struct Session *t = NULL; | 1604 | struct Session *t; |
1603 | |||
1604 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, | ||
1605 | plugin->name, | ||
1606 | "Disconnect for connection %p \n", sc); | ||
1607 | 1605 | ||
1606 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
1607 | "Disconnect for connection %p\n", | ||
1608 | sc); | ||
1608 | if (sc == NULL) | 1609 | if (sc == NULL) |
1609 | return; | 1610 | return; |
1610 | 1611 | ||
@@ -1618,12 +1619,12 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection, | |||
1618 | 1619 | ||
1619 | if (sc->direction == _SEND) | 1620 | if (sc->direction == _SEND) |
1620 | { | 1621 | { |
1621 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1622 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1622 | "Peer `%s' connection %p, GET on address `%s' disconnected\n", | 1623 | "Peer `%s' connection %p, GET on address `%s' disconnected\n", |
1623 | GNUNET_i2s (&s->target), s->server_send, | 1624 | GNUNET_i2s (&s->target), s->server_send, |
1624 | http_common_plugin_address_to_string (NULL, | 1625 | http_common_plugin_address_to_string (NULL, |
1625 | plugin->protocol, s->address->address, | 1626 | plugin->protocol, s->address->address, |
1626 | s->address->address_length)); | 1627 | s->address->address_length)); |
1627 | s->server_send = NULL; | 1628 | s->server_send = NULL; |
1628 | if (!(sc->options & OPTION_LONG_POLL) && NULL != (s->server_recv)) | 1629 | if (!(sc->options & OPTION_LONG_POLL) && NULL != (s->server_recv)) |
1629 | { | 1630 | { |
@@ -1638,12 +1639,12 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection, | |||
1638 | } | 1639 | } |
1639 | if (sc->direction == _RECEIVE) | 1640 | if (sc->direction == _RECEIVE) |
1640 | { | 1641 | { |
1641 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1642 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1642 | "Peer `%s' connection %p PUT on address `%s' disconnected\n", | 1643 | "Peer `%s' connection %p PUT on address `%s' disconnected\n", |
1643 | GNUNET_i2s (&s->target), s->server_recv, | 1644 | GNUNET_i2s (&s->target), s->server_recv, |
1644 | http_common_plugin_address_to_string (NULL, | 1645 | http_common_plugin_address_to_string (NULL, |
1645 | plugin->protocol, s->address->address, | 1646 | plugin->protocol, s->address->address, |
1646 | s->address->address_length)); | 1647 | s->address->address_length)); |
1647 | s->server_recv = NULL; | 1648 | s->server_recv = NULL; |
1648 | if (s->msg_tk != NULL) | 1649 | if (s->msg_tk != NULL) |
1649 | { | 1650 | { |
@@ -1657,12 +1658,12 @@ server_disconnect_cb (void *cls, struct MHD_Connection *connection, | |||
1657 | 1658 | ||
1658 | if (s->disconnect && (s->server_send == NULL) && (s->server_recv == NULL)) | 1659 | if (s->disconnect && (s->server_send == NULL) && (s->server_recv == NULL)) |
1659 | { | 1660 | { |
1660 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1661 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1661 | "Peer `%s' on address `%s' disconnected\n", | 1662 | "Peer `%s' on address `%s' disconnected\n", |
1662 | GNUNET_i2s (&s->target), | 1663 | GNUNET_i2s (&s->target), |
1663 | http_common_plugin_address_to_string (NULL, | 1664 | http_common_plugin_address_to_string (NULL, |
1664 | plugin->protocol, s->address->address, | 1665 | plugin->protocol, s->address->address, |
1665 | s->address->address_length)); | 1666 | s->address->address_length)); |
1666 | 1667 | ||
1667 | if ((GNUNET_YES == s->session_passed) && (GNUNET_NO == s->session_ended)) | 1668 | if ((GNUNET_YES == s->session_passed) && (GNUNET_NO == s->session_ended)) |
1668 | { | 1669 | { |
@@ -1690,17 +1691,17 @@ server_accept_cb (void *cls, const struct sockaddr *addr, socklen_t addr_len) | |||
1690 | 1691 | ||
1691 | if (plugin->cur_connections <= plugin->max_connections) | 1692 | if (plugin->cur_connections <= plugin->max_connections) |
1692 | { | 1693 | { |
1693 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1694 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1694 | _("Accepting connection (%u of %u) from `%s'\n"), | 1695 | _("Accepting connection (%u of %u) from `%s'\n"), |
1695 | plugin->cur_connections, plugin->max_connections, | 1696 | plugin->cur_connections, plugin->max_connections, |
1696 | GNUNET_a2s (addr, addr_len)); | 1697 | GNUNET_a2s (addr, addr_len)); |
1697 | return MHD_YES; | 1698 | return MHD_YES; |
1698 | } | 1699 | } |
1699 | else | 1700 | else |
1700 | { | 1701 | { |
1701 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, | 1702 | LOG (GNUNET_ERROR_TYPE_WARNING, |
1702 | _("Server reached maximum number connections (%u), rejecting new connection\n"), | 1703 | _("Server reached maximum number connections (%u), rejecting new connection\n"), |
1703 | plugin->max_connections); | 1704 | plugin->max_connections); |
1704 | return MHD_NO; | 1705 | return MHD_NO; |
1705 | } | 1706 | } |
1706 | } | 1707 | } |
@@ -1734,8 +1735,8 @@ server_v4_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1734 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1735 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1735 | return; | 1736 | return; |
1736 | #if 0 | 1737 | #if 0 |
1737 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1738 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1738 | "Running IPv4 server\n"); | 1739 | "Running IPv4 server\n"); |
1739 | #endif | 1740 | #endif |
1740 | plugin->server_v4_immediately = GNUNET_NO; | 1741 | plugin->server_v4_immediately = GNUNET_NO; |
1741 | GNUNET_assert (MHD_YES == MHD_run (plugin->server_v4)); | 1742 | GNUNET_assert (MHD_YES == MHD_run (plugin->server_v4)); |
@@ -1759,8 +1760,8 @@ server_v6_run (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
1759 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) | 1760 | if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) |
1760 | return; | 1761 | return; |
1761 | #if 0 | 1762 | #if 0 |
1762 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1763 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1763 | "Running IPv6 server\n"); | 1764 | "Running IPv6 server\n"); |
1764 | #endif | 1765 | #endif |
1765 | plugin->server_v6_immediately = GNUNET_NO; | 1766 | plugin->server_v6_immediately = GNUNET_NO; |
1766 | GNUNET_assert (MHD_YES == MHD_run (plugin->server_v6)); | 1767 | GNUNET_assert (MHD_YES == MHD_run (plugin->server_v6)); |
@@ -1812,10 +1813,9 @@ server_schedule (struct HTTP_Server_Plugin *plugin, | |||
1812 | { | 1813 | { |
1813 | if (timeout != last_timeout) | 1814 | if (timeout != last_timeout) |
1814 | { | 1815 | { |
1815 | 1816 | LOG (GNUNET_ERROR_TYPE_DEBUG, | |
1816 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1817 | "SELECT Timeout changed from %llu to %llu (ms)\n", |
1817 | "SELECT Timeout changed from %llu to %llu (ms)\n", | 1818 | last_timeout, timeout); |
1818 | last_timeout, timeout); | ||
1819 | last_timeout = timeout; | 1819 | last_timeout = timeout; |
1820 | } | 1820 | } |
1821 | if (timeout <= GNUNET_TIME_UNIT_SECONDS.rel_value_us / 1000LL) | 1821 | if (timeout <= GNUNET_TIME_UNIT_SECONDS.rel_value_us / 1000LL) |
@@ -1840,8 +1840,9 @@ server_schedule (struct HTTP_Server_Plugin *plugin, | |||
1840 | plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK; | 1840 | plugin->server_v4_task = GNUNET_SCHEDULER_NO_TASK; |
1841 | } | 1841 | } |
1842 | #if 0 | 1842 | #if 0 |
1843 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1843 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1844 | "Scheduling IPv4 server task in %llu ms\n", tv); | 1844 | "Scheduling IPv4 server task in %llu ms\n", |
1845 | tv); | ||
1845 | #endif | 1846 | #endif |
1846 | ret = | 1847 | ret = |
1847 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1848 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
@@ -1856,8 +1857,8 @@ server_schedule (struct HTTP_Server_Plugin *plugin, | |||
1856 | plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK; | 1857 | plugin->server_v6_task = GNUNET_SCHEDULER_NO_TASK; |
1857 | } | 1858 | } |
1858 | #if 0 | 1859 | #if 0 |
1859 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1860 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1860 | "Scheduling IPv6 server task in %llu ms\n", tv); | 1861 | "Scheduling IPv6 server task in %llu ms\n", tv); |
1861 | #endif | 1862 | #endif |
1862 | ret = | 1863 | ret = |
1863 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, | 1864 | GNUNET_SCHEDULER_add_select (GNUNET_SCHEDULER_PRIORITY_DEFAULT, |
@@ -1949,12 +1950,12 @@ server_load_certificate (struct HTTP_Server_Plugin *plugin) | |||
1949 | plugin->name, | 1950 | plugin->name, |
1950 | "CRYPTO_INIT", | 1951 | "CRYPTO_INIT", |
1951 | &plugin->crypto_init)) | 1952 | &plugin->crypto_init)) |
1952 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1953 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1953 | "Using crypto init string `%s'\n", | 1954 | "Using crypto init string `%s'\n", |
1954 | plugin->crypto_init); | 1955 | plugin->crypto_init); |
1955 | else | 1956 | else |
1956 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 1957 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
1957 | "Using default crypto init string \n"); | 1958 | "Using default crypto init string \n"); |
1958 | 1959 | ||
1959 | /* read key & certificates from file */ | 1960 | /* read key & certificates from file */ |
1960 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1961 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
@@ -1984,9 +1985,8 @@ server_load_certificate (struct HTTP_Server_Plugin *plugin) | |||
1984 | key_file, cert_file, NULL); | 1985 | key_file, cert_file, NULL); |
1985 | if (cert_creation == NULL) | 1986 | if (cert_creation == NULL) |
1986 | { | 1987 | { |
1987 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 1988 | LOG (GNUNET_ERROR_TYPE_ERROR, |
1988 | _ | 1989 | _("Could not create a new TLS certificate, program `gnunet-transport-certificate-creation' could not be started!\n")); |
1989 | ("Could not create a new TLS certificate, program `gnunet-transport-certificate-creation' could not be started!\n")); | ||
1990 | GNUNET_free (key_file); | 1990 | GNUNET_free (key_file); |
1991 | GNUNET_free (cert_file); | 1991 | GNUNET_free (cert_file); |
1992 | 1992 | ||
@@ -2008,10 +2008,9 @@ server_load_certificate (struct HTTP_Server_Plugin *plugin) | |||
2008 | 2008 | ||
2009 | if ((plugin->key == NULL) || (plugin->cert == NULL)) | 2009 | if ((plugin->key == NULL) || (plugin->cert == NULL)) |
2010 | { | 2010 | { |
2011 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, | 2011 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2012 | plugin->name, | 2012 | _("No usable TLS certificate found and creating one at `%s/%s' failed!\n"), |
2013 | _("No usable TLS certificate found and creating one at `%s/%s' failed!\n"), | 2013 | key_file, cert_file); |
2014 | key_file, cert_file); | ||
2015 | GNUNET_free (key_file); | 2014 | GNUNET_free (key_file); |
2016 | GNUNET_free (cert_file); | 2015 | GNUNET_free (cert_file); |
2017 | 2016 | ||
@@ -2048,8 +2047,8 @@ server_start (struct HTTP_Server_Plugin *plugin) | |||
2048 | #if BUILD_HTTPS | 2047 | #if BUILD_HTTPS |
2049 | if (GNUNET_SYSERR == server_load_certificate (plugin)) | 2048 | if (GNUNET_SYSERR == server_load_certificate (plugin)) |
2050 | { | 2049 | { |
2051 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 2050 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2052 | "Could not load or create server certificate! Loading plugin failed!\n"); | 2051 | "Could not load or create server certificate! Loading plugin failed!\n"); |
2053 | return GNUNET_SYSERR; | 2052 | return GNUNET_SYSERR; |
2054 | } | 2053 | } |
2055 | #endif | 2054 | #endif |
@@ -2057,14 +2056,14 @@ server_start (struct HTTP_Server_Plugin *plugin) | |||
2057 | 2056 | ||
2058 | #if MHD_VERSION >= 0x00090E00 | 2057 | #if MHD_VERSION >= 0x00090E00 |
2059 | timeout = HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL; | 2058 | timeout = HTTP_SERVER_NOT_VALIDATED_TIMEOUT.rel_value_us / 1000LL / 1000LL; |
2060 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2059 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2061 | "MHD can set timeout per connection! Default time out %u sec.\n", | 2060 | "MHD can set timeout per connection! Default time out %u sec.\n", |
2062 | timeout); | 2061 | timeout); |
2063 | #else | 2062 | #else |
2064 | timeout = HTTP_SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL; | 2063 | timeout = HTTP_SERVER_SESSION_TIMEOUT.rel_value_us / 1000LL / 1000LL; |
2065 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, | 2064 | LOG (GNUNET_ERROR_TYPE_WARNING, |
2066 | "MHD cannot set timeout per connection! Default time out %u sec.\n", | 2065 | "MHD cannot set timeout per connection! Default time out %u sec.\n", |
2067 | timeout); | 2066 | timeout); |
2068 | #endif | 2067 | #endif |
2069 | 2068 | ||
2070 | plugin->server_v4 = NULL; | 2069 | plugin->server_v4 = NULL; |
@@ -2105,9 +2104,9 @@ server_start (struct HTTP_Server_Plugin *plugin) | |||
2105 | server_log, NULL, MHD_OPTION_END); | 2104 | server_log, NULL, MHD_OPTION_END); |
2106 | if (plugin->server_v4 == NULL) | 2105 | if (plugin->server_v4 == NULL) |
2107 | { | 2106 | { |
2108 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 2107 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2109 | "Failed to start %s IPv4 server component on port %u\n", | 2108 | "Failed to start %s IPv4 server component on port %u\n", |
2110 | plugin->name, plugin->port); | 2109 | plugin->name, plugin->port); |
2111 | } | 2110 | } |
2112 | else | 2111 | else |
2113 | server_reschedule (plugin, plugin->server_v4, GNUNET_NO); | 2112 | server_reschedule (plugin, plugin->server_v4, GNUNET_NO); |
@@ -2152,9 +2151,9 @@ server_start (struct HTTP_Server_Plugin *plugin) | |||
2152 | server_log, NULL, MHD_OPTION_END); | 2151 | server_log, NULL, MHD_OPTION_END); |
2153 | if (plugin->server_v6 == NULL) | 2152 | if (plugin->server_v6 == NULL) |
2154 | { | 2153 | { |
2155 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 2154 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2156 | "Failed to start %s IPv6 server component on port %u\n", | 2155 | "Failed to start %s IPv6 server component on port %u\n", |
2157 | plugin->name, plugin->port); | 2156 | plugin->name, plugin->port); |
2158 | } | 2157 | } |
2159 | else | 2158 | else |
2160 | server_reschedule (plugin, plugin->server_v6, GNUNET_NO); | 2159 | server_reschedule (plugin, plugin->server_v6, GNUNET_NO); |
@@ -2163,9 +2162,9 @@ server_start (struct HTTP_Server_Plugin *plugin) | |||
2163 | msg = "No"; | 2162 | msg = "No"; |
2164 | if ((plugin->server_v6 == NULL) && (plugin->server_v4 == NULL)) | 2163 | if ((plugin->server_v6 == NULL) && (plugin->server_v4 == NULL)) |
2165 | { | 2164 | { |
2166 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 2165 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2167 | "%s %s server component started on port %u\n", | 2166 | "%s %s server component started on port %u\n", |
2168 | msg, plugin->name, plugin->port); | 2167 | msg, plugin->name, plugin->port); |
2169 | sleep (10); | 2168 | sleep (10); |
2170 | return GNUNET_SYSERR; | 2169 | return GNUNET_SYSERR; |
2171 | } | 2170 | } |
@@ -2175,9 +2174,9 @@ server_start (struct HTTP_Server_Plugin *plugin) | |||
2175 | msg = "IPv6"; | 2174 | msg = "IPv6"; |
2176 | else if (plugin->server_v4 != NULL) | 2175 | else if (plugin->server_v4 != NULL) |
2177 | msg = "IPv4"; | 2176 | msg = "IPv4"; |
2178 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2177 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2179 | "%s %s server component started on port %u\n", | 2178 | "%s %s server component started on port %u\n", |
2180 | msg, plugin->name, plugin->port); | 2179 | msg, plugin->name, plugin->port); |
2181 | return GNUNET_OK; | 2180 | return GNUNET_OK; |
2182 | } | 2181 | } |
2183 | 2182 | ||
@@ -2214,8 +2213,9 @@ server_stop (struct HTTP_Server_Plugin *plugin) | |||
2214 | GNUNET_free_non_null (plugin->key); | 2213 | GNUNET_free_non_null (plugin->key); |
2215 | #endif | 2214 | #endif |
2216 | 2215 | ||
2217 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2216 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2218 | "%s server component stopped\n", plugin->name); | 2217 | "%s server component stopped\n", |
2218 | plugin->name); | ||
2219 | } | 2219 | } |
2220 | 2220 | ||
2221 | 2221 | ||
@@ -2245,11 +2245,11 @@ server_add_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
2245 | w->addrlen = http_common_address_get_size (w->address); | 2245 | w->addrlen = http_common_address_get_size (w->address); |
2246 | 2246 | ||
2247 | GNUNET_CONTAINER_DLL_insert(plugin->addr_head, plugin->addr_tail, w); | 2247 | GNUNET_CONTAINER_DLL_insert(plugin->addr_head, plugin->addr_tail, w); |
2248 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2248 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2249 | "Notifying transport to add address `%s'\n", | 2249 | "Notifying transport to add address `%s'\n", |
2250 | http_common_plugin_address_to_string (NULL, | 2250 | http_common_plugin_address_to_string (NULL, |
2251 | plugin->protocol, | 2251 | plugin->protocol, |
2252 | w->address, w->addrlen)); | 2252 | w->address, w->addrlen)); |
2253 | /* modify our published address list */ | 2253 | /* modify our published address list */ |
2254 | #if BUILD_HTTPS | 2254 | #if BUILD_HTTPS |
2255 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | 2255 | address = GNUNET_HELLO_address_allocate (plugin->env->my_identity, |
@@ -2296,11 +2296,11 @@ server_remove_address (void *cls, int add_remove, const struct sockaddr *addr, | |||
2296 | if (NULL == w) | 2296 | if (NULL == w) |
2297 | return; | 2297 | return; |
2298 | 2298 | ||
2299 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2299 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2300 | "Notifying transport to remove address `%s'\n", | 2300 | "Notifying transport to remove address `%s'\n", |
2301 | http_common_plugin_address_to_string (NULL, | 2301 | http_common_plugin_address_to_string (NULL, |
2302 | plugin->protocol, | 2302 | plugin->protocol, |
2303 | w->address, w->addrlen)); | 2303 | w->address, w->addrlen)); |
2304 | 2304 | ||
2305 | 2305 | ||
2306 | GNUNET_CONTAINER_DLL_remove (plugin->addr_head, plugin->addr_tail, w); | 2306 | GNUNET_CONTAINER_DLL_remove (plugin->addr_head, plugin->addr_tail, w); |
@@ -2337,10 +2337,10 @@ server_nat_port_map_callback (void *cls, int add_remove, const struct sockaddr * | |||
2337 | GNUNET_assert (cls != NULL); | 2337 | GNUNET_assert (cls != NULL); |
2338 | struct HTTP_Server_Plugin *plugin = cls; | 2338 | struct HTTP_Server_Plugin *plugin = cls; |
2339 | 2339 | ||
2340 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2340 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2341 | "NAT called to %s address `%s'\n", | 2341 | "NAT called to %s address `%s'\n", |
2342 | (add_remove == GNUNET_NO) ? "remove" : "add", | 2342 | (add_remove == GNUNET_NO) ? "remove" : "add", |
2343 | GNUNET_a2s (addr, addrlen)); | 2343 | GNUNET_a2s (addr, addrlen)); |
2344 | 2344 | ||
2345 | if (AF_INET == addr->sa_family) | 2345 | if (AF_INET == addr->sa_family) |
2346 | { | 2346 | { |
@@ -2353,9 +2353,9 @@ server_nat_port_map_callback (void *cls, int add_remove, const struct sockaddr * | |||
2353 | (0 != memcmp (&plugin->server_addr_v4->sin_addr, | 2353 | (0 != memcmp (&plugin->server_addr_v4->sin_addr, |
2354 | &s4->sin_addr, sizeof (struct in_addr)))) | 2354 | &s4->sin_addr, sizeof (struct in_addr)))) |
2355 | { | 2355 | { |
2356 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2356 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2357 | "Skipping address `%s' (not bindto address)\n", | 2357 | "Skipping address `%s' (not bindto address)\n", |
2358 | GNUNET_a2s (addr, addrlen)); | 2358 | GNUNET_a2s (addr, addrlen)); |
2359 | return; | 2359 | return; |
2360 | } | 2360 | } |
2361 | } | 2361 | } |
@@ -2370,10 +2370,10 @@ server_nat_port_map_callback (void *cls, int add_remove, const struct sockaddr * | |||
2370 | (0 != memcmp (&plugin->server_addr_v6->sin6_addr, | 2370 | (0 != memcmp (&plugin->server_addr_v6->sin6_addr, |
2371 | &s6->sin6_addr, sizeof (struct in6_addr)))) | 2371 | &s6->sin6_addr, sizeof (struct in6_addr)))) |
2372 | { | 2372 | { |
2373 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2373 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2374 | "Skipping address `%s' (not bindto address)\n", | 2374 | "Skipping address `%s' (not bindto address)\n", |
2375 | GNUNET_a2s (addr, addrlen)); | 2375 | GNUNET_a2s (addr, addrlen)); |
2376 | return; | 2376 | return; |
2377 | } | 2377 | } |
2378 | } | 2378 | } |
2379 | 2379 | ||
@@ -2439,8 +2439,8 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin, | |||
2439 | } | 2439 | } |
2440 | if (0 == port) | 2440 | if (0 == port) |
2441 | { | 2441 | { |
2442 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name, | 2442 | LOG (GNUNET_ERROR_TYPE_INFO, |
2443 | "Starting in listen only mode\n"); | 2443 | "Starting in listen only mode\n"); |
2444 | return -1; /* listen only */ | 2444 | return -1; /* listen only */ |
2445 | } | 2445 | } |
2446 | 2446 | ||
@@ -2456,9 +2456,9 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin, | |||
2456 | 2456 | ||
2457 | if (hostname != NULL) | 2457 | if (hostname != NULL) |
2458 | { | 2458 | { |
2459 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2459 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2460 | "Resolving `%s' since that is where `%s' will bind to.\n", | 2460 | "Resolving `%s' since that is where `%s' will bind to.\n", |
2461 | hostname, service_name); | 2461 | hostname, service_name); |
2462 | memset (&hints, 0, sizeof (struct addrinfo)); | 2462 | memset (&hints, 0, sizeof (struct addrinfo)); |
2463 | if (disablev6) | 2463 | if (disablev6) |
2464 | hints.ai_family = AF_INET; | 2464 | hints.ai_family = AF_INET; |
@@ -2502,9 +2502,10 @@ server_get_addresses (struct HTTP_Server_Plugin *plugin, | |||
2502 | continue; /* not TCP */ | 2502 | continue; /* not TCP */ |
2503 | if ((pos->ai_socktype != SOCK_STREAM) && (pos->ai_socktype != 0)) | 2503 | if ((pos->ai_socktype != SOCK_STREAM) && (pos->ai_socktype != 0)) |
2504 | continue; /* huh? */ | 2504 | continue; /* huh? */ |
2505 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2505 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2506 | "Service will bind to `%s'\n", GNUNET_a2s (pos->ai_addr, | 2506 | "Service will bind to `%s'\n", |
2507 | pos->ai_addrlen)); | 2507 | GNUNET_a2s (pos->ai_addr, |
2508 | pos->ai_addrlen)); | ||
2508 | if (pos->ai_family == AF_INET) | 2509 | if (pos->ai_family == AF_INET) |
2509 | { | 2510 | { |
2510 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); | 2511 | GNUNET_assert (pos->ai_addrlen == sizeof (struct sockaddr_in)); |
@@ -2592,8 +2593,9 @@ server_start_report_addresses (struct HTTP_Server_Plugin *plugin) | |||
2592 | res = server_get_addresses (plugin, | 2593 | res = server_get_addresses (plugin, |
2593 | plugin->name, plugin->env->cfg, | 2594 | plugin->name, plugin->env->cfg, |
2594 | &addrs, &addrlens); | 2595 | &addrs, &addrlens); |
2595 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2596 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2596 | _("Found %u addresses to report to NAT service\n"), res); | 2597 | _("Found %u addresses to report to NAT service\n"), |
2598 | res); | ||
2597 | 2599 | ||
2598 | if (GNUNET_SYSERR == res) | 2600 | if (GNUNET_SYSERR == res) |
2599 | { | 2601 | { |
@@ -2663,9 +2665,8 @@ server_check_ipv6_support (struct HTTP_Server_Plugin *plugin) | |||
2663 | { | 2665 | { |
2664 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); | 2666 | GNUNET_log_strerror (GNUNET_ERROR_TYPE_ERROR, "socket"); |
2665 | } | 2667 | } |
2666 | GNUNET_log_from (GNUNET_ERROR_TYPE_WARNING, plugin->name, | 2668 | LOG (GNUNET_ERROR_TYPE_WARNING, |
2667 | _ | 2669 | _("Disabling IPv6 since it is not supported on this system!\n")); |
2668 | ("Disabling IPv6 since it is not supported on this system!\n")); | ||
2669 | res = GNUNET_NO; | 2670 | res = GNUNET_NO; |
2670 | } | 2671 | } |
2671 | else | 2672 | else |
@@ -2674,9 +2675,9 @@ server_check_ipv6_support (struct HTTP_Server_Plugin *plugin) | |||
2674 | desc = NULL; | 2675 | desc = NULL; |
2675 | res = GNUNET_YES; | 2676 | res = GNUNET_YES; |
2676 | } | 2677 | } |
2677 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2678 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2678 | "Testing IPv6 on this system: %s\n", | 2679 | "Testing IPv6 on this system: %s\n", |
2679 | (res == GNUNET_YES) ? "successful" : "failed"); | 2680 | (res == GNUNET_YES) ? "successful" : "failed"); |
2680 | return res; | 2681 | return res; |
2681 | } | 2682 | } |
2682 | 2683 | ||
@@ -2710,14 +2711,15 @@ server_notify_external_hostname (void *cls, const struct GNUNET_SCHEDULER_TaskCo | |||
2710 | memcpy (&ext_addr[1], url, urlen); | 2711 | memcpy (&ext_addr[1], url, urlen); |
2711 | GNUNET_free (url); | 2712 | GNUNET_free (url); |
2712 | 2713 | ||
2713 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2714 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2714 | "Notifying transport about external hostname address `%s'\n", plugin->external_hostname); | 2715 | "Notifying transport about external hostname address `%s'\n", |
2716 | plugin->external_hostname); | ||
2715 | 2717 | ||
2716 | #if BUILD_HTTPS | 2718 | #if BUILD_HTTPS |
2717 | if (GNUNET_YES == plugin->verify_external_hostname) | 2719 | if (GNUNET_YES == plugin->verify_external_hostname) |
2718 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name, | 2720 | LOG (GNUNET_ERROR_TYPE_INFO, |
2719 | "Enabling SSL verification for external hostname address `%s'\n", | 2721 | "Enabling SSL verification for external hostname address `%s'\n", |
2720 | plugin->external_hostname); | 2722 | plugin->external_hostname); |
2721 | plugin->ext_addr = GNUNET_HELLO_address_allocate (plugin->env->my_identity, | 2723 | plugin->ext_addr = GNUNET_HELLO_address_allocate (plugin->env->my_identity, |
2722 | "https_client", ext_addr, ext_addr_len, GNUNET_HELLO_ADDRESS_INFO_NONE ); | 2724 | "https_client", ext_addr, ext_addr_len, GNUNET_HELLO_ADDRESS_INFO_NONE ); |
2723 | plugin->env->notify_address (plugin->env->cls, GNUNET_YES, plugin->ext_addr); | 2725 | plugin->env->notify_address (plugin->env->cls, GNUNET_YES, plugin->ext_addr); |
@@ -2757,9 +2759,9 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2757 | } | 2759 | } |
2758 | else | 2760 | else |
2759 | plugin->use_ipv4 = GNUNET_YES; | 2761 | plugin->use_ipv4 = GNUNET_YES; |
2760 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2762 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2761 | _("IPv4 support is %s\n"), | 2763 | _("IPv4 support is %s\n"), |
2762 | (plugin->use_ipv4 == GNUNET_YES) ? "enabled" : "disabled"); | 2764 | (plugin->use_ipv4 == GNUNET_YES) ? "enabled" : "disabled"); |
2763 | 2765 | ||
2764 | /* Use IPv6? */ | 2766 | /* Use IPv6? */ |
2765 | if (GNUNET_CONFIGURATION_have_value | 2767 | if (GNUNET_CONFIGURATION_have_value |
@@ -2771,16 +2773,14 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2771 | } | 2773 | } |
2772 | else | 2774 | else |
2773 | plugin->use_ipv6 = GNUNET_YES; | 2775 | plugin->use_ipv6 = GNUNET_YES; |
2774 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2776 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2775 | _("IPv6 support is %s\n"), | 2777 | _("IPv6 support is %s\n"), |
2776 | (plugin->use_ipv6 == GNUNET_YES) ? "enabled" : "disabled"); | 2778 | (plugin->use_ipv6 == GNUNET_YES) ? "enabled" : "disabled"); |
2777 | 2779 | ||
2778 | if ((plugin->use_ipv4 == GNUNET_NO) && (plugin->use_ipv6 == GNUNET_NO)) | 2780 | if ((plugin->use_ipv4 == GNUNET_NO) && (plugin->use_ipv6 == GNUNET_NO)) |
2779 | { | 2781 | { |
2780 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 2782 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2781 | _ | 2783 | _("Neither IPv4 nor IPv6 are enabled! Fix in configuration\n")); |
2782 | ("Neither IPv4 nor IPv6 are enabled! Fix in configuration\n"), | ||
2783 | plugin->name); | ||
2784 | return GNUNET_SYSERR; | 2784 | return GNUNET_SYSERR; |
2785 | } | 2785 | } |
2786 | 2786 | ||
@@ -2789,31 +2789,29 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2789 | GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg, plugin->name, | 2789 | GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg, plugin->name, |
2790 | "PORT", &port)) || (port > 65535)) | 2790 | "PORT", &port)) || (port > 65535)) |
2791 | { | 2791 | { |
2792 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 2792 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2793 | _("Port is required! Fix in configuration\n"), | 2793 | _("Port is required! Fix in configuration\n")); |
2794 | plugin->name); | ||
2795 | return GNUNET_SYSERR; | 2794 | return GNUNET_SYSERR; |
2796 | } | 2795 | } |
2797 | plugin->port = port; | 2796 | plugin->port = port; |
2798 | 2797 | ||
2799 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name, | 2798 | LOG (GNUNET_ERROR_TYPE_INFO, |
2800 | _("Using port %u\n"), plugin->port); | 2799 | _("Using port %u\n"), plugin->port); |
2801 | 2800 | ||
2802 | if ((plugin->use_ipv4 == GNUNET_YES) && | 2801 | if ((plugin->use_ipv4 == GNUNET_YES) && |
2803 | (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, | 2802 | (GNUNET_YES == GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, |
2804 | plugin->name, "BINDTO", &bind4_address))) | 2803 | plugin->name, "BINDTO", &bind4_address))) |
2805 | { | 2804 | { |
2806 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2805 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2807 | "Binding %s plugin to specific IPv4 address: `%s'\n", | 2806 | "Binding %s plugin to specific IPv4 address: `%s'\n", |
2808 | plugin->protocol, bind4_address); | 2807 | plugin->protocol, bind4_address); |
2809 | plugin->server_addr_v4 = GNUNET_new (struct sockaddr_in); | 2808 | plugin->server_addr_v4 = GNUNET_new (struct sockaddr_in); |
2810 | if (1 != inet_pton (AF_INET, bind4_address, | 2809 | if (1 != inet_pton (AF_INET, bind4_address, |
2811 | &plugin->server_addr_v4->sin_addr)) | 2810 | &plugin->server_addr_v4->sin_addr)) |
2812 | { | 2811 | { |
2813 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 2812 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2814 | _ | 2813 | _("Specific IPv4 address `%s' in configuration file is invalid!\n"), |
2815 | ("Specific IPv4 address `%s' in configuration file is invalid!\n"), | 2814 | bind4_address); |
2816 | bind4_address); | ||
2817 | GNUNET_free (bind4_address); | 2815 | GNUNET_free (bind4_address); |
2818 | GNUNET_free (plugin->server_addr_v4); | 2816 | GNUNET_free (plugin->server_addr_v4); |
2819 | plugin->server_addr_v4 = NULL; | 2817 | plugin->server_addr_v4 = NULL; |
@@ -2821,8 +2819,9 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2821 | } | 2819 | } |
2822 | else | 2820 | else |
2823 | { | 2821 | { |
2824 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2822 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2825 | _("Binding to IPv4 address %s\n"), bind4_address); | 2823 | _("Binding to IPv4 address %s\n"), |
2824 | bind4_address); | ||
2826 | plugin->server_addr_v4->sin_family = AF_INET; | 2825 | plugin->server_addr_v4->sin_family = AF_INET; |
2827 | plugin->server_addr_v4->sin_port = htons (plugin->port); | 2826 | plugin->server_addr_v4->sin_port = htons (plugin->port); |
2828 | } | 2827 | } |
@@ -2834,17 +2833,16 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2834 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, | 2833 | GNUNET_CONFIGURATION_get_value_string (plugin->env->cfg, plugin->name, |
2835 | "BINDTO6", &bind6_address))) | 2834 | "BINDTO6", &bind6_address))) |
2836 | { | 2835 | { |
2837 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2836 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2838 | "Binding %s plugin to specific IPv6 address: `%s'\n", | 2837 | "Binding %s plugin to specific IPv6 address: `%s'\n", |
2839 | plugin->protocol, bind6_address); | 2838 | plugin->protocol, bind6_address); |
2840 | plugin->server_addr_v6 = GNUNET_new (struct sockaddr_in6); | 2839 | plugin->server_addr_v6 = GNUNET_new (struct sockaddr_in6); |
2841 | if (1 != | 2840 | if (1 != |
2842 | inet_pton (AF_INET6, bind6_address, &plugin->server_addr_v6->sin6_addr)) | 2841 | inet_pton (AF_INET6, bind6_address, &plugin->server_addr_v6->sin6_addr)) |
2843 | { | 2842 | { |
2844 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 2843 | LOG (GNUNET_ERROR_TYPE_ERROR, |
2845 | _ | 2844 | _("Specific IPv6 address `%s' in configuration file is invalid!\n"), |
2846 | ("Specific IPv6 address `%s' in configuration file is invalid!\n"), | 2845 | bind6_address); |
2847 | bind6_address); | ||
2848 | GNUNET_free (bind6_address); | 2846 | GNUNET_free (bind6_address); |
2849 | GNUNET_free (plugin->server_addr_v6); | 2847 | GNUNET_free (plugin->server_addr_v6); |
2850 | plugin->server_addr_v6 = NULL; | 2848 | plugin->server_addr_v6 = NULL; |
@@ -2852,8 +2850,9 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2852 | } | 2850 | } |
2853 | else | 2851 | else |
2854 | { | 2852 | { |
2855 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2853 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2856 | _("Binding to IPv6 address %s\n"), bind6_address); | 2854 | _("Binding to IPv6 address %s\n"), |
2855 | bind6_address); | ||
2857 | plugin->server_addr_v6->sin6_family = AF_INET6; | 2856 | plugin->server_addr_v6->sin6_family = AF_INET6; |
2858 | plugin->server_addr_v6->sin6_port = htons (plugin->port); | 2857 | plugin->server_addr_v6->sin6_port = htons (plugin->port); |
2859 | } | 2858 | } |
@@ -2863,14 +2862,14 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2863 | plugin->verify_external_hostname = GNUNET_NO; | 2862 | plugin->verify_external_hostname = GNUNET_NO; |
2864 | #if BUILD_HTTPS | 2863 | #if BUILD_HTTPS |
2865 | plugin->verify_external_hostname = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg, plugin->name, | 2864 | plugin->verify_external_hostname = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg, plugin->name, |
2866 | "VERIFY_EXTERNAL_HOSTNAME"); | 2865 | "VERIFY_EXTERNAL_HOSTNAME"); |
2867 | if (GNUNET_SYSERR == plugin->verify_external_hostname) | 2866 | if (GNUNET_SYSERR == plugin->verify_external_hostname) |
2868 | plugin->verify_external_hostname = GNUNET_NO; | 2867 | plugin->verify_external_hostname = GNUNET_NO; |
2869 | if (GNUNET_YES == plugin->verify_external_hostname) | 2868 | if (GNUNET_YES == plugin->verify_external_hostname) |
2870 | plugin->options |= HTTP_OPTIONS_VERIFY_CERTIFICATE; | 2869 | plugin->options |= HTTP_OPTIONS_VERIFY_CERTIFICATE; |
2871 | #endif | 2870 | #endif |
2872 | external_hostname_use_port = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg, plugin->name, | 2871 | external_hostname_use_port = GNUNET_CONFIGURATION_get_value_yesno (plugin->env->cfg, plugin->name, |
2873 | "EXTERNAL_HOSTNAME_USE_PORT"); | 2872 | "EXTERNAL_HOSTNAME_USE_PORT"); |
2874 | if (GNUNET_SYSERR == external_hostname_use_port) | 2873 | if (GNUNET_SYSERR == external_hostname_use_port) |
2875 | external_hostname_use_port = GNUNET_NO; | 2874 | external_hostname_use_port = GNUNET_NO; |
2876 | 2875 | ||
@@ -2904,8 +2903,9 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2904 | plugin->external_hostname = GNUNET_strdup (tmp); | 2903 | plugin->external_hostname = GNUNET_strdup (tmp); |
2905 | GNUNET_free (eh_tmp); | 2904 | GNUNET_free (eh_tmp); |
2906 | 2905 | ||
2907 | GNUNET_log_from (GNUNET_ERROR_TYPE_INFO, plugin->name, | 2906 | LOG (GNUNET_ERROR_TYPE_INFO, |
2908 | _("Using external hostname `%s'\n"), plugin->external_hostname); | 2907 | _("Using external hostname `%s'\n"), |
2908 | plugin->external_hostname); | ||
2909 | plugin->notify_ext_task = GNUNET_SCHEDULER_add_now (&server_notify_external_hostname, plugin); | 2909 | plugin->notify_ext_task = GNUNET_SCHEDULER_add_now (&server_notify_external_hostname, plugin); |
2910 | 2910 | ||
2911 | /* Use only configured external hostname */ | 2911 | /* Use only configured external hostname */ |
@@ -2920,12 +2920,13 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2920 | plugin->external_only = GNUNET_NO; | 2920 | plugin->external_only = GNUNET_NO; |
2921 | 2921 | ||
2922 | if (GNUNET_YES == plugin->external_only) | 2922 | if (GNUNET_YES == plugin->external_only) |
2923 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2923 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2924 | _("Notifying transport only about hostname `%s'\n"), plugin->external_hostname); | 2924 | _("Notifying transport only about hostname `%s'\n"), |
2925 | plugin->external_hostname); | ||
2925 | } | 2926 | } |
2926 | else | 2927 | else |
2927 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2928 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2928 | "No external hostname configured\n"); | 2929 | "No external hostname configured\n"); |
2929 | 2930 | ||
2930 | /* Optional parameters */ | 2931 | /* Optional parameters */ |
2931 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg, | 2932 | if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (plugin->env->cfg, |
@@ -2934,9 +2935,9 @@ server_configure_plugin (struct HTTP_Server_Plugin *plugin) | |||
2934 | max_connections = 128; | 2935 | max_connections = 128; |
2935 | plugin->max_connections = max_connections; | 2936 | plugin->max_connections = max_connections; |
2936 | 2937 | ||
2937 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 2938 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
2938 | _("Maximum number of connections is %u\n"), | 2939 | _("Maximum number of connections is %u\n"), |
2939 | plugin->max_connections); | 2940 | plugin->max_connections); |
2940 | 2941 | ||
2941 | 2942 | ||
2942 | plugin->peer_id_length = strlen (GNUNET_i2s_full (plugin->env->my_identity)); | 2943 | plugin->peer_id_length = strlen (GNUNET_i2s_full (plugin->env->my_identity)); |
@@ -3034,9 +3035,9 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
3034 | return NULL; | 3035 | return NULL; |
3035 | } | 3036 | } |
3036 | plugin->in_shutdown = GNUNET_YES; | 3037 | plugin->in_shutdown = GNUNET_YES; |
3037 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 3038 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
3038 | _("Shutting down plugin `%s'\n"), | 3039 | _("Shutting down plugin `%s'\n"), |
3039 | plugin->name); | 3040 | plugin->name); |
3040 | 3041 | ||
3041 | if (GNUNET_SCHEDULER_NO_TASK != plugin->notify_ext_task) | 3042 | if (GNUNET_SCHEDULER_NO_TASK != plugin->notify_ext_task) |
3042 | { | 3043 | { |
@@ -3046,12 +3047,12 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
3046 | 3047 | ||
3047 | if (NULL != plugin->ext_addr) | 3048 | if (NULL != plugin->ext_addr) |
3048 | { | 3049 | { |
3049 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 3050 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
3050 | "Notifying transport to remove address `%s'\n", | 3051 | "Notifying transport to remove address `%s'\n", |
3051 | http_common_plugin_address_to_string (NULL, | 3052 | http_common_plugin_address_to_string (NULL, |
3052 | plugin->protocol, | 3053 | plugin->protocol, |
3053 | plugin->ext_addr->address, | 3054 | plugin->ext_addr->address, |
3054 | plugin->ext_addr->address_length)); | 3055 | plugin->ext_addr->address_length)); |
3055 | #if BUILD_HTTPS | 3056 | #if BUILD_HTTPS |
3056 | plugin->env->notify_address (plugin->env->cls, | 3057 | plugin->env->notify_address (plugin->env->cls, |
3057 | GNUNET_NO, | 3058 | GNUNET_NO, |
@@ -3072,8 +3073,9 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
3072 | while (NULL != (pos = next)) | 3073 | while (NULL != (pos = next)) |
3073 | { | 3074 | { |
3074 | next = pos->next; | 3075 | next = pos->next; |
3075 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 3076 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
3076 | "Removing left over session %p\n", pos); | 3077 | "Removing left over session %p\n", |
3078 | pos); | ||
3077 | 3079 | ||
3078 | if ((GNUNET_YES == pos->session_passed) && (GNUNET_NO == pos->session_ended)) | 3080 | if ((GNUNET_YES == pos->session_passed) && (GNUNET_NO == pos->session_ended)) |
3079 | { | 3081 | { |
@@ -3091,9 +3093,9 @@ LIBGNUNET_PLUGIN_TRANSPORT_DONE (void *cls) | |||
3091 | GNUNET_free_non_null (plugin->server_addr_v6); | 3093 | GNUNET_free_non_null (plugin->server_addr_v6); |
3092 | regfree(&plugin->url_regex); | 3094 | regfree(&plugin->url_regex); |
3093 | 3095 | ||
3094 | GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, plugin->name, | 3096 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
3095 | _("Shutdown for plugin `%s' complete\n"), | 3097 | _("Shutdown for plugin `%s' complete\n"), |
3096 | plugin->name); | 3098 | plugin->name); |
3097 | 3099 | ||
3098 | GNUNET_free (plugin); | 3100 | GNUNET_free (plugin); |
3099 | GNUNET_free (api); | 3101 | GNUNET_free (api); |
@@ -3179,8 +3181,9 @@ LIBGNUNET_PLUGIN_TRANSPORT_INIT (void *cls) | |||
3179 | #endif | 3181 | #endif |
3180 | 3182 | ||
3181 | /* Compile URL regex */ | 3183 | /* Compile URL regex */ |
3182 | if (regcomp(&plugin->url_regex, URL_REGEX, REG_EXTENDED)) { | 3184 | if (regcomp(&plugin->url_regex, URL_REGEX, REG_EXTENDED)) |
3183 | GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, plugin->name, | 3185 | { |
3186 | LOG (GNUNET_ERROR_TYPE_ERROR, | ||
3184 | _("Unable to compile URL regex\n")); | 3187 | _("Unable to compile URL regex\n")); |
3185 | LIBGNUNET_PLUGIN_TRANSPORT_DONE (api); | 3188 | LIBGNUNET_PLUGIN_TRANSPORT_DONE (api); |
3186 | return NULL; | 3189 | return NULL; |