Ignore:
Timestamp:
Apr 22, 2009, 4:00:45 PM (13 years ago)
Author:
charles
Message:

(trunk libT) #1993: Check if UPNP port is still open. Patch from KyleK

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/upnp.c

    r7837 r8271  
    8181tr_upnpPulse( tr_upnp * handle,
    8282              int       port,
    83               int       isEnabled )
     83              int       isEnabled,
     84              int       doPortCheck )
    8485{
    8586    int ret;
     
    126127        if( handle->isMapped && ( !isEnabled || ( handle->port != port ) ) )
    127128            handle->state = TR_UPNP_UNMAP;
     129    }
     130
     131    if( isEnabled && handle->isMapped && doPortCheck )
     132    {
     133        char portStr[8];
     134        char intPort[8];
     135        char intClient[16];
     136        int i;
     137
     138        tr_snprintf( portStr, sizeof( portStr ), "%d", handle->port );
     139        i = UPNP_GetSpecificPortMappingEntry( handle->urls.controlURL,
     140                                              handle->data.servicetype, portStr,
     141                                              "TCP", intClient, intPort );
     142        if( i != UPNPCOMMAND_SUCCESS )
     143        {
     144            tr_ninf( getKey( ), _( "Port %d isn't forwarded" ), handle->port );
     145            handle->isMapped = FALSE;
     146        }
    128147    }
    129148
Note: See TracChangeset for help on using the changeset viewer.