aboutsummaryrefslogtreecommitdiff
path: root/src/transport/plugin_transport_udp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/transport/plugin_transport_udp.c')
-rw-r--r--src/transport/plugin_transport_udp.c26
1 files changed, 8 insertions, 18 deletions
diff --git a/src/transport/plugin_transport_udp.c b/src/transport/plugin_transport_udp.c
index f185c8738..477efc0a1 100644
--- a/src/transport/plugin_transport_udp.c
+++ b/src/transport/plugin_transport_udp.c
@@ -173,12 +173,6 @@ struct Session
173 struct GNUNET_TIME_Relative last_expected_msg_delay; 173 struct GNUNET_TIME_Relative last_expected_msg_delay;
174 174
175 /** 175 /**
176 * Address metrics (as set by the "update_address_metrics" by
177 * the environment).
178 */
179 struct GNUNET_ATS_Information ats;
180
181 /**
182 * Our own address. 176 * Our own address.
183 */ 177 */
184 struct GNUNET_HELLO_Address *address; 178 struct GNUNET_HELLO_Address *address;
@@ -202,6 +196,11 @@ struct Session
202 unsigned int rc; 196 unsigned int rc;
203 197
204 /** 198 /**
199 * Network type of the address.
200 */
201 enum GNUNET_ATS_Network_Type scope;
202
203 /**
205 * Is this session about to be destroyed (sometimes we cannot 204 * Is this session about to be destroyed (sometimes we cannot
206 * destroy a session immediately as below us on the stack 205 * destroy a session immediately as below us on the stack
207 * there might be code that still uses it; in this case, 206 * there might be code that still uses it; in this case,
@@ -1595,7 +1594,7 @@ static enum GNUNET_ATS_Network_Type
1595udp_get_network (void *cls, 1594udp_get_network (void *cls,
1596 struct Session *session) 1595 struct Session *session)
1597{ 1596{
1598 return ntohl (session->ats.value); 1597 return session->scope;
1599} 1598}
1600 1599
1601 1600
@@ -1742,11 +1741,8 @@ udp_plugin_create_session (void *cls,
1742 struct Session *s; 1741 struct Session *s;
1743 1742
1744 s = create_session (plugin, address); 1743 s = create_session (plugin, address);
1745 s->ats.type = htonl (GNUNET_ATS_NETWORK_TYPE); 1744 s->scope = network_type;
1746 s->ats.value = htonl (network_type);
1747 1745
1748 if (NULL == s)
1749 return NULL; /* protocol not supported or address invalid */
1750 LOG (GNUNET_ERROR_TYPE_DEBUG, 1746 LOG (GNUNET_ERROR_TYPE_DEBUG,
1751 "Creating new session %p for peer `%s' address `%s'\n", 1747 "Creating new session %p for peer `%s' address `%s'\n",
1752 s, 1748 s,
@@ -2213,16 +2209,11 @@ process_inbound_tokenized_messages (void *cls,
2213 if (GNUNET_YES == si->session->in_destroy) 2209 if (GNUNET_YES == si->session->in_destroy)
2214 return GNUNET_OK; 2210 return GNUNET_OK;
2215 /* setup ATS */ 2211 /* setup ATS */
2216 GNUNET_break (ntohl (si->session->ats.value) != GNUNET_ATS_NET_UNSPECIFIED);
2217 reschedule_session_timeout (si->session); 2212 reschedule_session_timeout (si->session);
2218 delay = plugin->env->receive (plugin->env->cls, 2213 delay = plugin->env->receive (plugin->env->cls,
2219 si->session->address, 2214 si->session->address,
2220 si->session, 2215 si->session,
2221 hdr); 2216 hdr);
2222 plugin->env->update_address_metrics (plugin->env->cls,
2223 si->session->address,
2224 si->session,
2225 &si->session->ats, 1);
2226 si->session->flow_delay_for_other_peer = delay; 2217 si->session->flow_delay_for_other_peer = delay;
2227 return GNUNET_OK; 2218 return GNUNET_OK;
2228} 2219}
@@ -2274,8 +2265,7 @@ process_udp_message (struct Plugin *plugin,
2274 plugin->env->session_start (plugin->env->cls, 2265 plugin->env->session_start (plugin->env->cls,
2275 address, 2266 address,
2276 s, 2267 s,
2277 NULL, 2268 s->scope);
2278 0);
2279 notify_session_monitor (s->plugin, 2269 notify_session_monitor (s->plugin,
2280 s, 2270 s,
2281 GNUNET_TRANSPORT_SS_INIT); 2271 GNUNET_TRANSPORT_SS_INIT);