Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lwip/tcp.c: remove unused and duplicated code #906

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 0 additions & 18 deletions src/vma/lwip/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,6 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
{
u32_t seqno, ackno;
u16_t remote_port, local_port;
ip_addr_t remote_ip, local_ip;
#if LWIP_CALLBACK_API
tcp_err_fn errf;
#endif /* LWIP_CALLBACK_API */
Expand All @@ -347,36 +346,19 @@ tcp_abandon(struct tcp_pcb *pcb, int reset)
int send_rst = reset && (get_tcp_state(pcb) != CLOSED);
seqno = pcb->snd_nxt;
ackno = pcb->rcv_nxt;
ip_addr_copy(local_ip, pcb->local_ip);
ip_addr_copy(remote_ip, pcb->remote_ip);
local_port = pcb->local_port;
remote_port = pcb->remote_port;
#if LWIP_CALLBACK_API
errf = pcb->errf;
#endif /* LWIP_CALLBACK_API */
errf_arg = pcb->my_container;
tcp_pcb_remove(pcb);
if (pcb->unacked != NULL) {
tcp_tx_segs_free(pcb, pcb->unacked);
pcb->unacked = NULL;
}
if (pcb->unsent != NULL) {
tcp_tx_segs_free(pcb, pcb->unsent);
pcb->unsent = NULL;
}
#if TCP_QUEUE_OOSEQ
if (pcb->ooseq != NULL) {
tcp_segs_free(pcb, pcb->ooseq);
}
#endif /* TCP_QUEUE_OOSEQ */
TCP_EVENT_ERR(errf, errf_arg, ERR_ABRT);
if (send_rst) {
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_abandon: sending RST\n"));
tcp_rst(seqno, ackno, local_port, remote_port, pcb);
}
}
(void)local_ip; /* Fix warning -Wunused-but-set-variable */
(void)remote_ip; /* Fix warning -Wunused-but-set-variable */
}

/**
Expand Down
1 change: 0 additions & 1 deletion src/vma/lwip/tcp.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ typedef err_t (*ip_output_fn)(struct pbuf *p, void* p_conn, u16_t flags);
#else
typedef err_t (*ip_output_fn)(struct pbuf *p, void* p_conn, int is_rexmit, u8_t is_dummy);
#endif /* LWIP_TSO */
void register_ip_output(ip_output_fn fn);

typedef ssize_t (*sys_readv_fn)(int __fd, const struct iovec *iov, int iovcnt);
void register_sys_readv(sys_readv_fn fn);
Expand Down
16 changes: 7 additions & 9 deletions src/vma/lwip/tcp_in.c
Original file line number Diff line number Diff line change
Expand Up @@ -379,8 +379,6 @@ tcp_listen_input(struct tcp_pcb_listen *pcb, tcp_in_data* in_data)
set_tcp_state(npcb, SYN_RCVD);
npcb->rcv_nxt = in_data->seqno + 1;
npcb->rcv_ann_right_edge = npcb->rcv_nxt;
npcb->snd_wnd = in_data->tcphdr->wnd;
npcb->ssthresh = npcb->snd_wnd;
npcb->snd_wl1 = in_data->seqno - 1;/* initialise to seqno-1 to force window update */
npcb->callback_arg = pcb->callback_arg;
#if LWIP_CALLBACK_API
Expand All @@ -398,14 +396,14 @@ tcp_listen_input(struct tcp_pcb_listen *pcb, tcp_in_data* in_data)
/* Parse any options in the SYN. */
tcp_parseopt(npcb, in_data);

npcb->rcv_wnd = TCP_WND_SCALED(npcb);
npcb->rcv_ann_wnd = TCP_WND_SCALED(npcb);
npcb->rcv_wnd_max = TCP_WND_SCALED(npcb);
npcb->rcv_wnd_max_desired = TCP_WND_SCALED(npcb);
npcb->rcv_wnd = TCP_WND_SCALED(npcb);
npcb->rcv_ann_wnd = TCP_WND_SCALED(npcb);
npcb->rcv_wnd_max = TCP_WND_SCALED(npcb);
npcb->rcv_wnd_max_desired = TCP_WND_SCALED(npcb);

npcb->snd_wnd = SND_WND_SCALE(npcb, in_data->tcphdr->wnd);
npcb->snd_wnd_max = npcb->snd_wnd;
npcb->ssthresh = npcb->snd_wnd;
npcb->snd_wnd = SND_WND_SCALE(npcb, in_data->tcphdr->wnd);
npcb->snd_wnd_max = npcb->snd_wnd;
npcb->ssthresh = npcb->snd_wnd;
#if TCP_CALCULATE_EFF_SEND_MSS
u16_t snd_mss = tcp_eff_send_mss(npcb->mss, npcb);
UPDATE_PCB_BY_MSS(npcb, snd_mss);
Expand Down
10 changes: 1 addition & 9 deletions src/vma/lwip/tcp_out.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ void register_sys_now(sys_now_fn fn)
}

#if LWIP_3RD_PARTY_L3
ip_output_fn external_ip_output;

void register_ip_output(ip_output_fn fn)
{
external_ip_output = fn;
}

ip_route_mtu_fn external_ip_route_mtu;

void register_ip_route_mtu(ip_route_mtu_fn fn)
Expand Down Expand Up @@ -1785,7 +1778,7 @@ tcp_output_segment(struct tcp_seg *seg, struct tcp_pcb *pcb)
* most other segment output functions.
*
* The pcb is given only when its valid and from an output context.
* It is used with the external_ip_output function.
* It is used with the pcb->ip_output() function.
*
* @param seqno the sequence number to use for the outgoing segment
* @param ackno the acknowledge number to use for the outgoing segment
Expand Down Expand Up @@ -1828,7 +1821,6 @@ tcp_rst(u32_t seqno, u32_t ackno, u16_t local_port, u16_t remote_port, struct tc
#else
if(pcb) pcb->ip_output(p, pcb, 0, 0);
#endif /* LWIP_TSO */
/* external_ip_output(p, NULL, local_ip, remote_ip, TCP_TTL, 0, IP_PROTO_TCP) */;
tcp_tx_pbuf_free(pcb, p);
LWIP_DEBUGF(TCP_RST_DEBUG, ("tcp_rst: seqno %"U32_F" ackno %"U32_F".\n", seqno, ackno));
}
Expand Down
1 change: 0 additions & 1 deletion src/vma/proto/vma_lwip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ vma_lwip::vma_lwip()
register_tcp_tx_pbuf_free(sockinfo_tcp::tcp_tx_pbuf_free);
register_tcp_seg_alloc(sockinfo_tcp::tcp_seg_alloc);
register_tcp_seg_free(sockinfo_tcp::tcp_seg_free);
register_ip_output(sockinfo_tcp::ip_output);
register_tcp_state_observer(sockinfo_tcp::tcp_state_observer);
register_ip_route_mtu(sockinfo_tcp::get_route_mtu);
register_sys_now(sys_now);
Expand Down