public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* [ECOS] FW: Closing sockets
@ 2008-03-05 11:04 Bell, Andrew [Allen & Heath UK]
  0 siblings, 0 replies; only message in thread
From: Bell, Andrew [Allen & Heath UK] @ 2008-03-05 11:04 UTC (permalink / raw)
  To: ecos-discuss

Hello All

I'm running 2 boxes both with eCos, connected using TCP / IP. 

I'm trying to clear up a socket if the customer simply switches one of
the boxes off or removes the Ethernet cable - non graceful socket
closure.

After looking at the httpd code, I've written a TTL style timeout for
inactivity. This works, but when I try calling shutdown after detecting
the lost comms:

shutdown(mSocket, SHUT_WR);
shutdown(mSocket, SHUT_RD);

If a thread was busy writing to the socket as the power fails on the
other unit, the thread blocks on send(), and the calls to shutdown from
my lostcomms thread fail to wake the blocked sending thread.

I've tried calling cyg_thread_release(handle) but this looks risky as
you need to be very aware of what the thread was blocked on.

If there a better way of waking a thread which is blocked on socket IO,
after the connection has died, other than trying to shutdown the socket
as this seems unreliable.

TIA

Andrew.




--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-03-05 11:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-05 11:04 [ECOS] FW: Closing sockets Bell, Andrew [Allen & Heath UK]

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).