From 3d232f4db0f777e49c932b7dd4586b736dacf8c3 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 18 Mar 2008 02:15:19 +0000 Subject: [PATCH] make the Port Forwarding error messages a little easier for beginners to understand --- libtransmission/natpmp.c | 6 +++--- libtransmission/shared.c | 2 ++ libtransmission/upnp.c | 14 +++++++------- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/libtransmission/natpmp.c b/libtransmission/natpmp.c index 8ed1d7455..e5a6d6c50 100644 --- a/libtransmission/natpmp.c +++ b/libtransmission/natpmp.c @@ -69,7 +69,7 @@ logVal( const char * func, int ret ) else if( ret >= 0 ) tr_ndbg( getKey(), _( "%s succeeded (%d)" ), func, ret ); else - tr_nerr( getKey(), _( "%s failed (%d): %s (%d)" ), func, ret, tr_strerror(errno), errno ); + tr_ndbg( getKey(), _( "%s failed (%d): %s (%d)" ), func, ret, tr_strerror(errno), errno ); } struct tr_natpmp* @@ -109,8 +109,8 @@ setCommandTime( struct tr_natpmp * nat ) static void setErrorState( struct tr_natpmp * nat ) { - tr_nerr( getKey(), _( "If your router supports NAT-PMP, please make sure NAT-PMP is enabled!" ) ); - tr_nerr( getKey(), _( "NAT-PMP port forwarding unsuccessful, trying UPnP next" ) ); + tr_ndbg( getKey(), _( "If your router supports NAT-PMP, please make sure NAT-PMP is enabled!" ) ); + tr_ndbg( getKey(), _( "NAT-PMP port forwarding unsuccessful, trying UPnP next" ) ); nat->state = TR_NATPMP_ERR; } diff --git a/libtransmission/shared.c b/libtransmission/shared.c index d60b78fb4..07bed66c9 100644 --- a/libtransmission/shared.c +++ b/libtransmission/shared.c @@ -95,6 +95,8 @@ natPulse( tr_shared * s ) if( status != s->natStatus ) { tr_ninf( getKey(), _( "State changed from \"%s\" to \"%s\"" ), getNatStateStr(s->natStatus), getNatStateStr(status) ); s->natStatus = status; + if( status == TR_NAT_TRAVERSAL_ERROR ) + tr_nerr( getKey(), _( "Port forwarding failed. See debug messages for more information." ) ); } } diff --git a/libtransmission/upnp.c b/libtransmission/upnp.c index 174b07aa6..efa1e6009 100644 --- a/libtransmission/upnp.c +++ b/libtransmission/upnp.c @@ -88,18 +88,18 @@ tr_upnpPulse( tr_upnp * handle, int port, int isEnabled ) errno = 0; devlist = upnpDiscover( 2000, NULL, NULL ); if( devlist == NULL ) { - tr_nerr( getKey(), _( "upnpDiscover failed (errno %d - %s)" ), errno, tr_strerror(errno) ); + tr_ndbg( getKey(), _( "upnpDiscover failed (errno %d - %s)" ), errno, tr_strerror(errno) ); } errno = 0; if( UPNP_GetValidIGD( devlist, &handle->urls, &handle->data, handle->lanaddr, sizeof(handle->lanaddr))) { - tr_ninf( getKey(), _( "Found Internet Gateway Device \"%s\"" ), handle->urls.controlURL ); - tr_ninf( getKey(), _( "Local Address is \"%s\"" ), handle->lanaddr ); + tr_ndbg( getKey(), _( "Found Internet Gateway Device \"%s\"" ), handle->urls.controlURL ); + tr_ndbg( getKey(), _( "Local Address is \"%s\"" ), handle->lanaddr ); handle->state = TR_UPNP_IDLE; handle->hasDiscovered = 1; } else { handle->state = TR_UPNP_ERR; - tr_nerr( getKey(), _( "UPNP_GetValidIGD failed (errno %d - %s)" ), errno, tr_strerror(errno) ); - tr_nerr( getKey(), _( "If your router supports UPnP, please make sure UPnP is enabled!" ) ); + tr_ndbg( getKey(), _( "UPNP_GetValidIGD failed (errno %d - %s)" ), errno, tr_strerror(errno) ); + tr_ndbg( getKey(), _( "If your router supports UPnP, please make sure UPnP is enabled!" ) ); } freeUPNPDevlist( devlist ); } @@ -153,8 +153,8 @@ tr_upnpPulse( tr_upnp * handle, int port, int isEnabled ) handle->port = port; handle->state = TR_UPNP_IDLE; } else { - tr_nerr( getKey(), _( "Port forwarding failed with error %d (%d - %s)" ), err, errno, tr_strerror(errno) ); - tr_nerr( getKey(), _( "If your router supports UPnP, please make sure UPnP is enabled!" ) ); + tr_ndbg( getKey(), _( "Port forwarding failed with error %d (%d - %s)" ), err, errno, tr_strerror(errno) ); + tr_ndbg( getKey(), _( "If your router supports UPnP, please make sure UPnP is enabled!" ) ); handle->port = -1; handle->state = TR_UPNP_ERR; }