/[lwip]/lwip/src/core/tcp_out.c
ViewVC logotype

Diff of /lwip/src/core/tcp_out.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.17 by likewise, Tue Mar 25 12:59:42 2003 UTC revision 1.18 by likewise, Mon Apr 7 21:28:16 2003 UTC
# Line 167  tcp_enqueue(struct tcp_pcb *pcb, void *a Line 167  tcp_enqueue(struct tcp_pcb *pcb, void *a
167      and data copied into pbuf, otherwise data comes from      and data copied into pbuf, otherwise data comes from
168      ROM or other static memory, and need not be copied. If      ROM or other static memory, and need not be copied. If
169      optdata is != NULL, we have options instead of data. */      optdata is != NULL, we have options instead of data. */
170      if(optdata != NULL) {      if (optdata != NULL) {
171        if((seg->p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) {        if((seg->p = pbuf_alloc(PBUF_TRANSPORT, optlen, PBUF_RAM)) == NULL) {
172          goto memerr;          goto memerr;
173        }        }
174        ++queuelen;        ++queuelen;
175        seg->dataptr = seg->p->payload;        seg->dataptr = seg->p->payload;
176      }      }
177      else if(copy) {      else if (copy) {
178        if((seg->p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_RAM)) == NULL) {        if((seg->p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_RAM)) == NULL) {
179          DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for pbuf copy size %u\n", seglen));              DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for pbuf copy size %u\n", seglen));    
180          goto memerr;          goto memerr;
# Line 185  tcp_enqueue(struct tcp_pcb *pcb, void *a Line 185  tcp_enqueue(struct tcp_pcb *pcb, void *a
185        }        }
186        seg->dataptr = seg->p->payload;        seg->dataptr = seg->p->payload;
187      }      }
188        /* do not copy data */
189      else {      else {
       /* Do not copy the data. */  
190    
191        /* First, allocate a pbuf for holding the data. */        /* first, allocate a pbuf for holding the data.
192        if((p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_REF)) == NULL) {         * since the referenced data is available at least until it is sent out on the
193          DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for pbuf non-copy\n"));                         * link (as it has to be ACKed by the remote party) we can safely use PBUF_ROM
194           * instead of PBUF_REF here.
195           */
196          if((p = pbuf_alloc(PBUF_TRANSPORT, seglen, PBUF_ROM)) == NULL) {
197            DEBUGF(TCP_OUTPUT_DEBUG, ("tcp_enqueue: could not allocate memory for zero-copy pbuf\n"));                
198          goto memerr;          goto memerr;
199        }        }
200        ++queuelen;        ++queuelen;

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26