- "Server: Creating new session for peer `%s' \n", GNUNET_i2s (&target));
-#endif
-
- s = create_session (plugin,
- &target,
- conn_info->client_addr,
- addrlen,
- NULL,
- NULL);
-
+ "Server: Creating new session for peer `%s' \n",
+ GNUNET_i2s (&target));
+ switch (conn_info->client_addr->sa_family)
+ {
+ case (AF_INET):
+ s4 = ((struct sockaddr_in *) conn_info->client_addr);
+ a4.u4_port = s4->sin_port;
+ memcpy (&a4.ipv4_addr, &s4->sin_addr, sizeof (struct in_addr));
+ a = &a4;
+ a_len = sizeof (struct IPv4HttpAddress);
+ ats = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) s4, sizeof (struct sockaddr_in));
+ break;
+ case (AF_INET6):
+ s6 = ((struct sockaddr_in6 *) conn_info->client_addr);
+ a6.u6_port = s6->sin6_port;
+ memcpy (&a6.ipv6_addr, &s6->sin6_addr, sizeof (struct in6_addr));
+ a = &a6;
+ a_len = sizeof (struct IPv6HttpAddress);
+ ats = plugin->env->get_address_type (plugin->env->cls, (const struct sockaddr *) s6, sizeof (struct sockaddr_in6));
+ break;
+ default:
+ GNUNET_break (0);
+ goto error;
+ }
+ s = create_session (plugin, &target, a, a_len);
+ GNUNET_assert (NULL != s);
+ s->ats_address_network_type = ats.value;