Skip to content
Snippets Groups Projects
Closed use of SO_REUSEADDR socket option, was: Error binding network socket: Address already in use
  • View options
  • use of SO_REUSEADDR socket option, was: Error binding network socket: Address already in use

  • View options
  • Closed Issue created by Trac

    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.

    Roger's answer

    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.

    --Roger

    Trac:
    Username: Falo

    Linked items 0

  • Link items together to show that they're related.

    Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first