{"push_id":872524318,"size":1,"distinct_size":1,"ref":"refs/heads/master","head":"b2f03e170f818236192f43952ee7a6239f67d4e2","before":"5be4f5379ef995762f04c98654d219a6980ae713","commits":[{"sha":"b2f03e170f818236192f43952ee7a6239f67d4e2","author":{"email":"328b27c99317b12d4abcd46c4810451f3997abf9@chromium.org","name":"Thiago Farina"},"message":"udpserver.c: set SO_REUSEADDR\n\nThis is useful when your server has been shut down and then\nrestarted right away while sockets are still active on its port.\n\nThis is very easily reproduced, just start ./udpserver,\nctrl+C to quit it, run it again very quickly, noticed that before this\nchange, it would fail to bind to the give address/port, unless you\nwaited a few moments.\n\nWith this change it is not necessary to wait anymore, the server can be\nrestarted right away.\n\nFull explanation at www.unixguide.net/network/socketfaq/4.5.shtml.\n\nReproduced here:\nWhat exactly does SO_REUSEADDR do?\n\nThis socket option tells the kernel that even if this port is busy (in\nthe TIME_WAIT state), go ahead and reuse it anyway.\nIf it is busy, but with another state, you will still get an address already in\nuse error.  It is useful if your server has been shut down, and then restarted\nright away while sockets are still active on its port.  You should be aware\nthat if any unexpected data comes in, it may confuse your server, but while this\nis possible, it is not likely.\n\nIt has been pointed out that \"A socket is a 5 tuple (proto, local addr,\nlocal port, remote addr, remote port). SO_REUSEADDR just says that you can reuse\nlocal addresses.  The 5 tuple still must be unique!\" by Michael Hunter\n(mphunter@qnx.com).  This is true, and this is why it is very unlikely that\nunexpected data will ever be seen by your server.  The danger is that such a 5\ntuple is still floating around on the net, and while it is bouncing around, a\nnew connection from the same client, on the same system, happens to get the same\nremote port.  This is explained by Richard Stevens in ``2.7 Please explain the\nTIME_WAIT state.''.\n\nSigned-off-by: Thiago Farina <tfarina@chromium.org>","distinct":true,"url":"https://api.github.com/repos/tfarina/rsc/commits/b2f03e170f818236192f43952ee7a6239f67d4e2"}]}