How to deal with sockets when client crashes.

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

 



Hello,

In my transport protocol, which implements a 3-way handshake, I have the
following problem:

Let's say CLIENT 'C' from port 'c' tries to connect to SERVER 'S' to port
's':

'S' creates a new socket s1[s,c] in accept routine and hashes it.
Now 'C' and 'S' happily exchange data when suddenly 'C' crashes ('S'
doesn't know that and keeps s1 in the hash).

Then 'C' connects (using the same port c) to 'S', again, 'S' creates a new
socket in accept routine: s2[s,c]. But now, when they want to exchange
data, server doesn't know to which of its sockets socket put the data: s1
or s2? They are basically identical from the hash function's point of view.


How should I solve this problem? Should I check in accept whether there is
any ESTABLISHED socket with the same [s,c] and destroy it? Or maybe return
error from accept?
Thanks!

-marek

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux