aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_tcp.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2012-05-14 23:44:22 +0000
committerChristian Grothoff <christian@grothoff.org>2012-05-14 23:44:22 +0000
commit720afac61536fbb212c0010f31764704c12aab0f (patch)
tree323e2147f8c13f27c5699e237d08649a2f6242d3 /src/transport/plugin_transport_tcp.c
parentb633941315e126aed01437fb56bcc8dfb64908b1 (diff)
downloadgnunet-720afac61536fbb212c0010f31764704c12aab0f.tar.gz
gnunet-720afac61536fbb212c0010f31764704c12aab0f.zip
-fixing misc seaspider parser errors
Diffstat (limited to 'src/transport/plugin_transport_tcp.c')
-rw-r--r--src/transport/plugin_transport_tcp.c40
1 files changed, 24 insertions, 16 deletions
diff --git a/src/transport/plugin_transport_tcp.c b/src/transport/plugin_transport_tcp.c
index 9c3fedc75..1a4ab765a 100644
--- a/src/transport/plugin_transport_tcp.c
+++ b/src/transport/plugin_transport_tcp.c
@@ -457,6 +457,8 @@ plugin_tcp_access_check (void *cls,
457{ 457{
458 struct Plugin *plugin = cls; 458 struct Plugin *plugin = cls;
459 459
460 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
461 "Accepting new incoming TCP connection\n");
460 if (0 == plugin->max_connections) 462 if (0 == plugin->max_connections)
461 return GNUNET_NO; 463 return GNUNET_NO;
462 plugin->max_connections--; 464 plugin->max_connections--;
@@ -712,6 +714,9 @@ create_session (struct Plugin *plugin, const struct GNUNET_PeerIdentity *target,
712 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", 714 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
713 "Creating new session for peer `%4s'\n", 715 "Creating new session for peer `%4s'\n",
714 GNUNET_i2s (target)); 716 GNUNET_i2s (target));
717 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
718 "Creating new TCP session for peer `%s'\n",
719 GNUNET_i2s (target));
715 720
716 ret = GNUNET_malloc (sizeof (struct Session)); 721 ret = GNUNET_malloc (sizeof (struct Session));
717 ret->last_activity = GNUNET_TIME_absolute_get (); 722 ret->last_activity = GNUNET_TIME_absolute_get ();
@@ -1089,9 +1094,10 @@ struct SessionItCtx
1089 struct Session * result; 1094 struct Session * result;
1090}; 1095};
1091 1096
1092int session_lookup_it (void *cls, 1097static int
1093 const GNUNET_HashCode * key, 1098session_lookup_it (void *cls,
1094 void *value) 1099 const GNUNET_HashCode * key,
1100 void *value)
1095{ 1101{
1096 struct SessionItCtx * si_ctx = cls; 1102 struct SessionItCtx * si_ctx = cls;
1097 struct Session * session = value; 1103 struct Session * session = value;
@@ -1144,11 +1150,10 @@ nat_connect_timeout (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
1144 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", 1150 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
1145 "NAT WAIT connection to `%4s' at `%s' could not be established, removing session\n", 1151 "NAT WAIT connection to `%4s' at `%s' could not be established, removing session\n",
1146 GNUNET_i2s (&session->target), tcp_address_to_string(NULL, session->addr, session->addrlen)); 1152 GNUNET_i2s (&session->target), tcp_address_to_string(NULL, session->addr, session->addrlen));
1147
1148 disconnect_session (session); 1153 disconnect_session (session);
1149
1150} 1154}
1151 1155
1156
1152/** 1157/**
1153 * Create a new session to transmit data to the target 1158 * Create a new session to transmit data to the target
1154 * This session will used to send data to this peer and the plugin will 1159 * This session will used to send data to this peer and the plugin will
@@ -1164,7 +1169,6 @@ tcp_plugin_get_session (void *cls,
1164{ 1169{
1165 struct Plugin * plugin = cls; 1170 struct Plugin * plugin = cls;
1166 struct Session * session = NULL; 1171 struct Session * session = NULL;
1167
1168 int af; 1172 int af;
1169 const void *sb; 1173 const void *sb;
1170 size_t sbs; 1174 size_t sbs;
@@ -1175,20 +1179,19 @@ tcp_plugin_get_session (void *cls,
1175 const struct IPv6TcpAddress *t6; 1179 const struct IPv6TcpAddress *t6;
1176 struct GNUNET_ATS_Information ats; 1180 struct GNUNET_ATS_Information ats;
1177 unsigned int is_natd = GNUNET_NO; 1181 unsigned int is_natd = GNUNET_NO;
1178 size_t addrlen = 0; 1182 size_t addrlen;
1179 1183
1180 GNUNET_assert (plugin != NULL); 1184 GNUNET_assert (plugin != NULL);
1181 GNUNET_assert (address != NULL); 1185 GNUNET_assert (address != NULL);
1182
1183 addrlen = address->address_length; 1186 addrlen = address->address_length;
1184 1187 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "tcp",
1185 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", 1188 "Trying to get session for `%s' address of peer `%s'\n",
1186 "Trying to get session for `%s' address length %i\n",
1187 tcp_address_to_string(NULL, address->address, address->address_length), 1189 tcp_address_to_string(NULL, address->address, address->address_length),
1188 addrlen); 1190 GNUNET_i2s (&address->peer));
1189 1191
1190 /* look for existing session */ 1192 /* look for existing session */
1191 if (GNUNET_CONTAINER_multihashmap_contains(plugin->sessionmap, &address->peer.hashPubKey)) 1193 if (GNUNET_YES ==
1194 GNUNET_CONTAINER_multihashmap_contains(plugin->sessionmap, &address->peer.hashPubKey))
1192 { 1195 {
1193 struct SessionItCtx si_ctx; 1196 struct SessionItCtx si_ctx;
1194 1197
@@ -1208,6 +1211,11 @@ tcp_plugin_get_session (void *cls,
1208 session); 1211 session);
1209 return session; 1212 return session;
1210 } 1213 }
1214 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "tcp",
1215 "Existing sessions did not match address `%s' or peer `%s'\n",
1216 tcp_address_to_string(NULL, address->address, address->address_length),
1217 GNUNET_i2s (&address->peer));
1218
1211 } 1219 }
1212 1220
1213 if (addrlen == sizeof (struct IPv6TcpAddress)) 1221 if (addrlen == sizeof (struct IPv6TcpAddress))
@@ -1281,7 +1289,7 @@ tcp_plugin_get_session (void *cls,
1281 &address->peer.hashPubKey))) 1289 &address->peer.hashPubKey)))
1282 { 1290 {
1283 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", 1291 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp",
1284 _("Found valid IPv4 NAT address (creating session)!\n")); 1292 "Found valid IPv4 NAT address (creating session)!\n") ;
1285 session = create_session (plugin, &address->peer, NULL, GNUNET_YES); 1293 session = create_session (plugin, &address->peer, NULL, GNUNET_YES);
1286 session->addrlen = 0; 1294 session->addrlen = 0;
1287 session->addr = NULL; 1295 session->addr = NULL;
@@ -1324,7 +1332,7 @@ tcp_plugin_get_session (void *cls,
1324 } 1332 }
1325 plugin->max_connections--; 1333 plugin->max_connections--;
1326 1334
1327 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", 1335 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "tcp",
1328 "Asked to transmit to `%4s', creating fresh session using address `%s'.\n", 1336 "Asked to transmit to `%4s', creating fresh session using address `%s'.\n",
1329 GNUNET_i2s (&address->peer), GNUNET_a2s (sb, sbs)); 1337 GNUNET_i2s (&address->peer), GNUNET_a2s (sb, sbs));
1330 1338
@@ -1769,7 +1777,7 @@ handle_tcp_welcome (void *cls, struct GNUNET_SERVER_Client *client,
1769 return; 1777 return;
1770 } 1778 }
1771 1779
1772 GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "tcp", 1780 GNUNET_log_from (GNUNET_ERROR_TYPE_ERROR, "tcp",
1773 "Received %s message from `%4s'\n", "WELCOME", 1781 "Received %s message from `%4s'\n", "WELCOME",
1774 GNUNET_i2s (&wm->clientIdentity)); 1782 GNUNET_i2s (&wm->clientIdentity));
1775 GNUNET_STATISTICS_update (plugin->env->stats, 1783 GNUNET_STATISTICS_update (plugin->env->stats,