Skip to content

Commit

Permalink
gnrc_tcp - Release pakets on failed gnrc_netapi_send()
Browse files Browse the repository at this point in the history
  • Loading branch information
brummer-simon committed Aug 31, 2019
1 parent 2101458 commit 351220e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion sys/net/gnrc/transport_layer/tcp/gnrc_tcp_eventloop.c
Expand Up @@ -224,7 +224,10 @@ static int _receive(gnrc_pktsnip_t *pkt)
DEBUG("gnrc_tcp_eventloop.c : _receive() : Can't find fitting tcb\n");
if ((ctl & MSK_RST) != MSK_RST) {
_pkt_build_reset_from_pkt(&reset, pkt);
gnrc_netapi_send(gnrc_tcp_pid, reset);
if (gnrc_netapi_send(gnrc_tcp_pid, reset) < 1) {
DEBUG("gnrc_tcp_eventloop.c : _receive() : unable to send reset paket\n");
gnrc_pktbuf_release(reset);
}
}
gnrc_pktbuf_release(pkt);
return -ENOTCONN;
Expand Down
5 changes: 4 additions & 1 deletion sys/net/gnrc/transport_layer/tcp/gnrc_tcp_pkt.c
Expand Up @@ -271,7 +271,10 @@ int _pkt_send(gnrc_tcp_tcb_t *tcb, gnrc_pktsnip_t *out_pkt, const uint16_t seq_c
}

/* Pass packet down the network stack */
gnrc_netapi_send(gnrc_tcp_pid, out_pkt);
if (gnrc_netapi_send(gnrc_tcp_pid, out_pkt) < 1) {
DEBUG("gnrc_tcp_pkt.c : _pkt_send() : unable to send packet\n");
gnrc_pktbuf_release(out_pkt);
}
return 0;
}

Expand Down

0 comments on commit 351220e

Please sign in to comment.