Cleanup of some formatting and comments.

This commit is contained in:
likewise 2003-05-20 08:16:29 +00:00
parent cd65d36822
commit 30d5b11628

View File

@ -115,14 +115,14 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
} }
/* seqno will be the sequence number of the first segment enqueued /* seqno will be the sequence number of the first segment enqueued
by the call to this function. */ * by the call to this function. */
seqno = pcb->snd_lbb; seqno = pcb->snd_lbb;
queue = NULL; queue = NULL;
DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: queuelen: %d\n", pcb->snd_queuelen)); DEBUGF(TCP_QLEN_DEBUG, ("tcp_enqueue: queuelen: %d\n", pcb->snd_queuelen));
/* Check if the queue length exceeds the configured maximum queue /* Check if the queue length exceeds the configured maximum queue
length. If so, we return an error. */ * length. If so, we return an error. */
queuelen = pcb->snd_queuelen; queuelen = pcb->snd_queuelen;
if (queuelen >= TCP_SND_QUEUELEN) { if (queuelen >= TCP_SND_QUEUELEN) {
DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_enqueue: too long queue %d (max %d)\n", queuelen, TCP_SND_QUEUELEN)); DEBUGF(TCP_OUTPUT_DEBUG | 3, ("tcp_enqueue: too long queue %d (max %d)\n", queuelen, TCP_SND_QUEUELEN));
@ -138,11 +138,11 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
seglen = 0; seglen = 0;
/* First, break up the data into segments and tuck them together in /* First, break up the data into segments and tuck them together in
the local "queue" variable. */ * the local "queue" variable. */
while (queue == NULL || left > 0) { while (queue == NULL || left > 0) {
/* The segment length should be the MSS if the data to be enqueued /* The segment length should be the MSS if the data to be enqueued
is larger than the MSS. */ * is larger than the MSS. */
seglen = left > pcb->mss? pcb->mss: left; seglen = left > pcb->mss? pcb->mss: left;
/* Allocate memory for tcp_seg, and fill in fields. */ /* Allocate memory for tcp_seg, and fill in fields. */
@ -159,14 +159,14 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
} }
else { else {
/* Attach the segment to the end of the queued segments. */ /* Attach the segment to the end of the queued segments. */
for(useg = queue; useg->next != NULL; useg = useg->next); for (useg = queue; useg->next != NULL; useg = useg->next);
useg->next = seg; useg->next = seg;
} }
/* If copy is set, memory should be allocated /* If copy is set, memory should be allocated
and data copied into pbuf, otherwise data comes from * and data copied into pbuf, otherwise data comes from
ROM or other static memory, and need not be copied. If * ROM or other static memory, and need not be copied. If
optdata is != NULL, we have options instead of data. */ * optdata is != NULL, we have options instead of data. */
if (optdata != NULL) { if (optdata != NULL) {
if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) { if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) {
goto memerr; goto memerr;
@ -204,7 +204,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
/* Second, allocate a pbuf for the headers. */ /* Second, allocate a pbuf for the headers. */
if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM)) == NULL) { if ((seg->p = pbuf_alloc(PBUF_TRANSPORT, 0, PBUF_RAM)) == NULL) {
/* If allocation fails, we have to deallocate the data pbuf as /* If allocation fails, we have to deallocate the data pbuf as
well. */ * well. */
pbuf_free(p); pbuf_free(p);
DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for header pbuf\n")); DEBUGF(TCP_OUTPUT_DEBUG | 2, ("tcp_enqueue: could not allocate memory for header pbuf\n"));
goto memerr; goto memerr;
@ -214,6 +214,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
/* Chain the headers and data pbufs together. */ /* Chain the headers and data pbufs together. */
pbuf_chain(seg->p, p); pbuf_chain(seg->p, p);
pbuf_free(p); pbuf_free(p);
p = NULL;
} }
/* Now that there are more segments queued, we check again if the /* Now that there are more segments queued, we check again if the
@ -224,10 +225,11 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
} }
seg->len = seglen; seg->len = seglen;
/* if ((flags & TCP_SYN) || (flags & TCP_FIN)) { #if 0 /* Was commented out. TODO: can someone say why this is here? */
++seg->len; if ((flags & TCP_SYN) || (flags & TCP_FIN)) {
}*/ ++seg->len;
}
#endif
/* Build TCP header. */ /* Build TCP header. */
if (pbuf_header(seg->p, TCP_HLEN)) { if (pbuf_header(seg->p, TCP_HLEN)) {
@ -275,7 +277,7 @@ tcp_enqueue(struct tcp_pcb *pcb, void *arg, u16_t len,
useg = NULL; useg = NULL;
} }
else { else {
for(useg = pcb->unsent; useg->next != NULL; useg = useg->next); for (useg = pcb->unsent; useg->next != NULL; useg = useg->next);
} }
/* If there is room in the last pbuf on the unsent queue, /* If there is room in the last pbuf on the unsent queue,
@ -459,7 +461,7 @@ tcp_output(struct tcp_pcb *pcb)
} else { } else {
for(useg = pcb->unacked; useg->next != NULL; useg = useg->next); for (useg = pcb->unacked; useg->next != NULL; useg = useg->next);
useg->next = seg; useg->next = seg;
} }
} else { } else {
@ -575,7 +577,7 @@ tcp_rexmit(struct tcp_pcb *pcb)
} }
/* Move all unacked segments to the unsent queue. */ /* Move all unacked segments to the unsent queue. */
for(seg = pcb->unacked; seg->next != NULL; seg = seg->next); for (seg = pcb->unacked; seg->next != NULL; seg = seg->next);
seg->next = pcb->unsent; seg->next = pcb->unsent;
pcb->unsent = pcb->unacked; pcb->unsent = pcb->unacked;