lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [lwip-users] tcp_enqueue problem, using socket:


From: Piero 74
Subject: Re: [lwip-users] tcp_enqueue problem, using socket:
Date: Wed, 19 Mar 2008 15:52:52 +0100

the piece of code was inside do_writemore function.

Bill, can you check this idea? or can you integrate here your test
tcp_accept_data

???

thanks,
Piero

2008/3/19, Piero 74 <address@hidden>:
i saw this piece of code in tcp_write:

....

  err = tcp_write(conn->pcb.tcp, dataptr, len, conn->write_msg->msg.w.apiflags);
  LWIP_ASSERT("do_writemore: invalid length!", ((conn->write_offset + len) <= conn->write_msg->msg.w.len));
  if (err == ERR_OK) {
    conn->write_offset += len;
    if (conn->write_offset == conn->write_msg->msg.w.len) {
      /* everything was written */
      write_finished = 1;
      conn->write_msg = NULL;
      conn->write_offset = 0;
    }
    err = tcp_output_nagle(conn->pcb.tcp);
    conn->err = err;
    if ((err == ERR_OK) && (tcp_sndbuf(conn->pcb.tcp) <= TCP_SNDLOWAT)) {
      API_EVENT(conn, NETCONN_EVT_SENDMINUS, len);
    }
  } else if (err == ERR_MEM) {
    /* tcp_enqueue returned ERR_MEM, try tcp_output anyway */
    err = tcp_output(conn->pcb.tcp);

#if LWIP_TCPIP_CORE_LOCKING
    conn->write_delayed = 1;
#endif
  } else {
    /* if ERR_MEM, we wait for sent_tcp or poll_tcp to be called                           <--------- wrong comment??? ERR_CONN instead ERR_MEM
       on other errors we don't try writing any more */
    conn->err = err;
    write_finished = 1;
  }

  if (write_finished) {
    /* everything was written: set back connection state
       and back to application task */

....

first, i suppose there is a wrong comment (see above)
second, i propose a patch (but i'm not sure);
if tcp_enqueue returned ERR_MEM, instead of try tcp_output anyway, exit using

    conn->err = err;
    write_finished = 1;

what do you think???

Piero.


2008/3/19, Piero 74 <address@hidden>:
i didn't understand this suggest:

#define tcp_accept_data(pcb) ((pcb)->snd_buf > 0 * (((pcb)->queuelen < TCP_SND_QUEUELEN))

0 * (((pcb)->queuelen < TCP_SND_QUEUELEN) is always 0, right???

where have i to add this macro??





reply via email to

[Prev in Thread] Current Thread [Next in Thread]