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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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));
Note: See TracChangeset for help on using the changeset viewer.