Closing a socket.
Joel Sherrill <joel@OARcorp.com>
joel.sherrill at OARcorp.com
Wed May 11 21:55:05 UTC 2005
Chris Johns wrote:
> Thomas Rauscher wrote:
>
>>
>> Maybe there is a race condition (visual check against 4.6.2).
>> Please correct me if I'm wrong.
>
>
> Yes there is a problem here.
>
>>
>> If rtems_bsdnet_close is called, the socket is freed in
>> soclose (depends on socket state, protocol used, ...).
>> The waiting thread might wake up later (depends on
>> scheduling) and could access so->so_pgid in soconnsleep().
>> Bad things would happen if this memory area is now used for something
>> else...
>> I remember having seen this in an accept/close race
>> (rtems 4.5).
>
>
> It looks to me like a bug in accept which I am looking at.
Where is the code you are looking at? I want to peek.
>> A clean (and portable) way is to send a "QUIT" message to the socket
>> so that the blocking
>> thread can stop using the socket.
>>
>
> What do you mean by a "QUIT" message ? Is this a way to have soconnwake
> and friends called ? If so a standard close on a socket fd does this.
>
>> TCP connections can be closed with shutdown().
>
>
> Is this a TCP socket shutdown or an RTEMS shutdown ?
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list