use of SO_REUSEADDR socket option, was: Error binding network socket: Address already in use
Blutmagie and Tory exits frequently log the error Apr 04 15:27:48.706 [warn] Error binding network socket: Address already in use
According to Roger's answer to my today's posting on tor-relays mailing list the SO_REUSEADDR socket option isn't used in all cases. It might be an idea to set this option in any case.
Actually, we only use SO_REUSEADDR when binding listening sockets. The errors you're seeing are likely because you can't open a new socket for an outbound connection. And we don't use SO_REUSEADDR when creating outbound sockets: see connection_connect().
We also don't set SO_REUSEADDR on the new socket we make after receiving connections on a listening socket: see connection_handle_listener_read().
I don't know what behavior to expect, but I would not be surprised to learn that we should set it in both of these cases too. Worth experimenting.