lwip-devel
[Top][All Lists]
Advanced

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

[lwip-devel] [task #10088] Correctly implement close() vs. shutdown()


From: Jeff Barber
Subject: [lwip-devel] [task #10088] Correctly implement close() vs. shutdown()
Date: Mon, 22 Feb 2010 14:33:55 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 GTB6

Follow-up Comment #17, task #10088 (project lwip):

As preface, let me re-iterate that, for a raw app, I think close() is exactly
equal to:
[shutdown(RDWR)] *or* 
[shutdown(RD) + shutdown(WR)] *or* 
[FIN-received plus shutdown(WR)].  

And it would be nice if lwIP fully supported TCP "half-closed" behavior in
both directions.  Finally, the transition from active session to "closed"
session needs to be done in an unambiguous way so that the raw app knows when
it is safe to access the pcb.

>From the above, I think the stack behavior follows fairly naturally.  The
receiving function is finished when either:
(1) the local app has called shutdown(RD) (or shutdown(RDWR) or close);  OR
(2) when a FIN is received from the remote peer (indicated to the local app
by NULL pointer argument to recv callback). 

The sending function is finished when the local app has called
shutdown(WR)(or shutdown(RDWR) or close()).  (This sends FIN to the peer.)

The local app may not access the pcb any more once both the receiving
function and the sending function have been terminated.  Of course, if a RST
is received from the remote peer at any time, the "err" callback is invoked
and the pcb may not be accessed by the app after that.

Also, I think this agrees with Kieran's comment #15 below:
we should *not* send RST when receiving data after we called shutdown(RD). 
(As long as we have not *also* done shutdown(WR).)


    _______________________________________________________

Reply to this item at:

  <http://savannah.nongnu.org/task/?10088>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.nongnu.org/





reply via email to

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