Changeset 11752


Ignore:
Timestamp:
Jan 22, 2011, 8:43:36 PM (11 years ago)
Author:
jordan
Message:

(trunk libT) #3906 "DHT ignores bind-address-ipv6" -- make the process of getting the binding address consistent between IPv4 and IPv6 sockets.

As suggested by Juiusz after the IPv6 binding commit in r11749. See: https://trac.transmissionbt.com/ticket/3906#comment:6

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/session.c

    r11709 r11752  
    707707    tr_sessionSet( session, &settings );
    708708
    709     tr_udpInit( session, &session->public_ipv4->addr );
     709    tr_udpInit( session );
    710710
    711711    if( session->isLPDEnabled )
     
    19471947    tr_udpUninit( session );
    19481948    session->isDHTEnabled = !session->isDHTEnabled;
    1949     tr_udpInit( session, &session->public_ipv4->addr );
     1949    tr_udpInit( session );
    19501950}
    19511951
  • trunk/libtransmission/tr-udp.c

    r11749 r11752  
    149149
    150150void
    151 tr_udpInit(tr_session *ss, const tr_address * addr)
    152 {
     151tr_udpInit(tr_session *ss)
     152{
     153    tr_bool is_default;
     154    const struct tr_address * public_addr;
    153155    struct sockaddr_in sin;
    154156    int rc;
     
    169171    memset(&sin, 0, sizeof(sin));
    170172    sin.sin_family = AF_INET;
    171     memcpy(&sin.sin_addr, &addr->addr.addr4, sizeof (struct in_addr));
     173    public_addr = tr_sessionGetPublicAddress(ss, TR_AF_INET, &is_default);
     174    if(public_addr && !is_default)
     175        memcpy(&sin.sin_addr, &public_addr->addr.addr4, sizeof (struct in_addr));
    172176    sin.sin_port = htons(ss->udp_port);
    173177    rc = bind(ss->udp_socket, (struct sockaddr*)&sin, sizeof(sin));
  • trunk/libtransmission/tr-udp.h

    r11653 r11752  
    2626#endif
    2727
    28 void tr_udpInit( tr_session *, const tr_address *);
     28void tr_udpInit( tr_session * );
    2929void tr_udpUninit( tr_session * );
    3030
Note: See TracChangeset for help on using the changeset viewer.