You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
{
struct Session *session = udpw->session;
+ if (GNUNET_YES == session->in_destroy)
+ {
+ GNUNET_break (0);
+ return;
+ }
if (plugin->bytes_in_buffer + udpw->msg_size > INT64_MAX)
{
GNUNET_break (0);
GNUNET_NO);
GNUNET_STATISTICS_update (plugin->env->stats,
"# UDP, unfragmented bytes payload queued total",
- udpw->payload_size,
+ msgbuf_size,
GNUNET_NO);
}
else
return;
}
udp_ack = (const struct UDP_ACK_Message *) msg;
+ ack = (const struct GNUNET_MessageHeader *) &udp_ack[1];
+ if (ntohs (ack->size) != ntohs (msg->size) - sizeof(struct UDP_ACK_Message))
+ {
+ GNUNET_break_op(0);
+ return;
+ }
address = GNUNET_HELLO_address_allocate (&udp_ack->sender,
PLUGIN_NAME,
udp_addr,
}
if (NULL == s->frag_ctx)
{
- LOG (GNUNET_ERROR_TYPE_WARNING,
- "Fragmentation context of address %s for ACK not found\n",
+ LOG (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK,
+ "Fragmentation context of address %s for ACK (%s) not found\n",
udp_address_to_string (plugin,
address->address,
- address->address_length));
+ address->address_length),
+ GNUNET_FRAGMENT_print_ack (ack));
GNUNET_HELLO_address_free (address);
return;
}
GNUNET_i2s (&udp_ack->sender));
s->flow_delay_from_other_peer = GNUNET_TIME_relative_to_absolute (flow_delay);
- ack = (const struct GNUNET_MessageHeader *) &udp_ack[1];
- if (ntohs (ack->size) != ntohs (msg->size) - sizeof(struct UDP_ACK_Message))
- {
- GNUNET_break_op(0);
- return;
- }
if (GNUNET_OK !=
GNUNET_FRAGMENT_process_ack (s->frag_ctx->frag,
fragmented_message_done (s->frag_ctx,
GNUNET_SYSERR);
}
-
+ GNUNET_assert (GNUNET_YES ==
+ GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
+ &s->target,
+ s));
frc.rc = NULL;
frc.udp_addr = s->address->address;
frc.udp_addr_len = s->address->address_length;
GNUNET_free (d_ctx);
}
}
+ s->in_destroy = GNUNET_YES;
next = plugin->ipv4_queue_head;
while (NULL != (udpw = next))
{
GNUNET_free (udpw);
}
}
- notify_session_monitor (s->plugin,
- s,
- GNUNET_TRANSPORT_SS_DONE);
- plugin->env->session_end (plugin->env->cls,
- s->address,
- s);
-
if ( (NULL != s->frag_ctx) &&
(NULL != s->frag_ctx->cont) )
{
s->frag_ctx->payload_size,
s->frag_ctx->on_wire_size);
}
-
- GNUNET_assert (GNUNET_YES ==
- GNUNET_CONTAINER_multipeermap_remove (plugin->sessions,
- &s->target,
- s));
+ notify_session_monitor (s->plugin,
+ s,
+ GNUNET_TRANSPORT_SS_DONE);
+ plugin->env->session_end (plugin->env->cls,
+ s->address,
+ s);
GNUNET_STATISTICS_set (plugin->env->stats,
"# UDP sessions active",
GNUNET_CONTAINER_multipeermap_size (plugin->sessions),
GNUNET_NO);
- if (s->rc > 0)
- {
- s->in_destroy = GNUNET_YES;
- }
- else
- {
+ if (0 == s->rc)
free_session (s);
- }
return GNUNET_OK;
}
"# UDP sessions active",
GNUNET_CONTAINER_multipeermap_size (plugin->sessions),
GNUNET_NO);
+ notify_session_monitor (plugin,
+ s,
+ GNUNET_TRANSPORT_SS_INIT);
return s;
}
{
struct Plugin *plugin = cls;
struct Session *s;
- enum GNUNET_ATS_Network_Type network_type;
+ enum GNUNET_ATS_Network_Type network_type = GNUNET_ATS_NET_UNSPECIFIED;
const struct IPv4UdpAddress *udp_v4;
const struct IPv6UdpAddress *udp_v6;
address,
s,
s->scope);
- notify_session_monitor (s->plugin,
- s,
- GNUNET_TRANSPORT_SS_INIT);
- notify_session_monitor (s->plugin,
+ notify_session_monitor (plugin,
s,
GNUNET_TRANSPORT_SS_UP);
}
if (GNUNET_NO == rc->have_sender)
{
/* tried to defragment but never succeeded, hence will not ACK */
- GNUNET_break_op (0);
+ /* This can happen if we just lost msgs */
+ GNUNET_STATISTICS_update (plugin->env->stats,
+ "# UDP, fragments discarded without ACK",
+ 1,
+ GNUNET_NO);
return;
}
address = GNUNET_HELLO_address_allocate (&rc->sender,
delay = s->flow_delay_for_other_peer.rel_value_us;
else
delay = UINT32_MAX;
-
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Sending ACK to `%s' including delay of %s\n",
udp_address_to_string (plugin,
/* Connection failure or something. Not a protocol violation. */
return;
}
+
+
+ /* PROCESS STUN PACKET */
+ if(GNUNET_NAT_try_decode_stun_packet(plugin->nat,(uint8_t *)buf, size ))
+ return;
+
+
if (size < sizeof(struct GNUNET_MessageHeader))
{
LOG (GNUNET_ERROR_TYPE_WARNING,
GNUNET_break_op (0);
return;
}
+
+
+
+
msg = (const struct GNUNET_MessageHeader *) buf;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"UDP received %u-byte message from `%s' type %u\n",
if (GNUNET_TIME_UNIT_ZERO.rel_value_us == remaining.rel_value_us)
{
/* Message timed out */
- udpw->qc (udpw->qc_cls,
- udpw,
- GNUNET_SYSERR);
- /* Remove message */
removed = GNUNET_YES;
dequeue (plugin,
udpw);
+ udpw->qc (udpw->qc_cls,
+ udpw,
+ GNUNET_SYSERR);
GNUNET_free (udpw);
if (sock == plugin->sockv4)
else
{
GNUNET_break (0);
+ dequeue (plugin,
+ udpw);
udpw->qc (udpw->qc_cls,
udpw,
GNUNET_SYSERR);
- dequeue (plugin,
- udpw);
notify_session_monitor (plugin,
udpw->session,
GNUNET_TRANSPORT_SS_UPDATE);
udpw->msg_size,
a,
slen);
+ dequeue (plugin,
+ udpw);
if (GNUNET_SYSERR == sent)
{
/* Failure */
udpw,
GNUNET_OK);
}
- dequeue (plugin,
- udpw);
notify_session_monitor (plugin,
udpw->session,
GNUNET_TRANSPORT_SS_UPDATE);
plugin->select_task_v4 = NULL;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
+ if (NULL == plugin->sockv4)
+ return;
if ((0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) &&
- (NULL != plugin->sockv4) &&
(GNUNET_NETWORK_fdset_isset (tc->read_ready,
plugin->sockv4)))
udp_select_read (plugin,
plugin->select_task_v6 = NULL;
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
+ if (NULL == plugin->sockv6)
+ return;
if ( (0 != (tc->reason & GNUNET_SCHEDULER_REASON_READ_READY)) &&
- (NULL != plugin->sockv6) &&
(GNUNET_NETWORK_fdset_isset (tc->read_ready,
plugin->sockv6)) )
udp_select_read (plugin,
plugin->sockv6);
+
udp_select_send (plugin,
plugin->sockv6);
schedule_select_v6 (plugin);
addrlens,
&udp_nat_port_map_callback,
NULL,
- plugin);
+ plugin,
+ plugin->sockv4);
return sockets_created;
}