sine we now have two public ports (peer and rpc), rename "publicPort" as "peerPort"

This commit is contained in:
Charles Kerr 2008-05-23 16:18:58 +00:00
parent f9e8b56816
commit d18fb68fbc
13 changed files with 36 additions and 37 deletions

View File

@ -43,7 +43,7 @@ saveState( tr_handle * h )
tr_bencDictAddStr( &d, "download-dir", tr_sessionGetDownloadDir( h ) );
tr_bencDictAddInt( &d, "peer-limit", tr_sessionGetPeerLimit( h ) );
tr_bencDictAddInt( &d, "pex-allowed", tr_sessionIsPexEnabled( h ) );
tr_bencDictAddInt( &d, "port", tr_sessionGetPublicPort( h ) );
tr_bencDictAddInt( &d, "port", tr_sessionGetPeerPort( h ) );
tr_bencDictAddInt( &d, "port-forwarding-enabled",
tr_sessionIsPortForwardingEnabled( h ) );
tr_bencDictAddStr( &d, "rpc-acl", tr_sessionGetRPCACL( h ) );

View File

@ -893,7 +893,7 @@ prefschanged( TrCore * core UNUSED, const char * key, gpointer data )
else if( !strcmp( key, PREF_KEY_PORT ) )
{
const int port = pref_int_get( key );
tr_sessionSetPublicPort( tr, port );
tr_sessionSetPeerPort( tr, port );
}
else if( !strcmp( key, PREF_KEY_DL_LIMIT_ENABLED ) )
{

View File

@ -533,10 +533,6 @@ networkPage( GObject * core, gpointer alive )
hig_workarea_add_row_w( t, &row, w, w2, NULL );
hig_workarea_add_section_title (t, &row, _( "Ports" ) );
s = _("_Forward port from router" );
w = new_check_button( s, PREF_KEY_NAT, core );
hig_workarea_add_wide_control( t, &row, w );
h = gtk_hbox_new( FALSE, GUI_PAD_BIG );
w2 = new_spin_button( PREF_KEY_PORT, core, 1, INT_MAX, 1 );
@ -544,22 +540,26 @@ networkPage( GObject * core, gpointer alive )
l = gtk_label_new( NULL );
gtk_misc_set_alignment( GTK_MISC(l), 0.0f, 0.5f );
gtk_box_pack_start( GTK_BOX(h), l, FALSE, FALSE, 0 );
hig_workarea_add_row( t, &row, _("Incoming _port:"), h, w );
hig_workarea_add_row( t, &row, _("Listen for _peers on port:"), h, w );
g_object_set_data( G_OBJECT(l), "tr-port-spin", w2 );
g_object_set_data( G_OBJECT(l), "alive", alive );
g_object_set_data( G_OBJECT(l), "handle", tr_core_handle( TR_CORE( core ) ) );
testing_port_cb( NULL, l );
g_signal_connect( w, "toggled", G_CALLBACK(testing_port_cb), l );
g_signal_connect( w2, "value-changed", G_CALLBACK(testing_port_cb), l );
s = _( "Listen for _RPC requests on port:" );
w = new_check_button( s, PREF_KEY_RPC_ENABLED, core );
w2 = new_spin_button( PREF_KEY_RPC_PORT, core, 0, 65535, 1 );
gtk_widget_set_sensitive( GTK_WIDGET(w2), pref_flag_get( PREF_KEY_RPC_ENABLED ) );
g_signal_connect( w, "toggled", G_CALLBACK(target_cb), w2 );
hig_workarea_add_row_w( t, &row, w, w2, NULL );
s = _("_Forward these port(s) from my router" );
w = new_check_button( s, PREF_KEY_NAT, core );
hig_workarea_add_wide_control( t, &row, w );
g_signal_connect( w, "toggled", G_CALLBACK(testing_port_cb), l );
g_signal_connect( w2, "value-changed", G_CALLBACK(testing_port_cb), l );
hig_workarea_finish( t, &row );
return t;

View File

@ -871,7 +871,7 @@ sendLtepHandshake( tr_peermsgs * msgs )
tr_bencInitDict( &val, 4 );
tr_bencDictAddInt( &val, "e", msgs->handle->encryptionMode != TR_PLAINTEXT_PREFERRED );
tr_bencDictAddInt( &val, "p", tr_sessionGetPublicPort( msgs->handle ) );
tr_bencDictAddInt( &val, "p", tr_sessionGetPeerPort( msgs->handle ) );
tr_bencDictAddStr( &val, "v", TR_NAME " " USERAGENT_PREFIX );
m = tr_bencDictAddDict( &val, "m", 1 );
if( pex )

View File

@ -214,7 +214,7 @@ tr_sharedSetPort( tr_shared * s, int port )
}
int
tr_sharedGetPublicPort( const tr_shared * s )
tr_sharedGetPeerPort( const tr_shared * s )
{
return s->publicPort;
}

View File

@ -29,13 +29,13 @@
typedef struct tr_shared tr_shared;
tr_shared* tr_sharedInit ( tr_handle *, int isEnabled,
int publicPort );
void tr_sharedShuttingDown ( tr_shared * );
void tr_sharedSetPort ( tr_shared *, int publicPort );
void tr_sharedTraversalEnable ( tr_shared *, int isEnabled );
int tr_sharedGetPublicPort ( const tr_shared * s );
int tr_sharedTraversalIsEnabled( const tr_shared * s );
int tr_sharedTraversalStatus ( const tr_shared * );
tr_shared* tr_sharedInit ( tr_handle *, int isEnabled,
int publicPort );
void tr_sharedShuttingDown ( tr_shared * );
void tr_sharedSetPort ( tr_shared *, int publicPort );
void tr_sharedTraversalEnable ( tr_shared *, int isEnabled );
int tr_sharedGetPeerPort ( const tr_shared * s );
int tr_sharedTraversalIsEnabled ( const tr_shared * s );
int tr_sharedTraversalStatus ( const tr_shared * );
#endif

View File

@ -592,7 +592,7 @@ sessionSet( tr_handle * h, tr_benc * args_in, tr_benc * args_out UNUSED )
if( tr_bencDictFindInt( args_in, "pex-allowed", &i ) )
tr_sessionSetPexEnabled( h, i );
if( tr_bencDictFindInt( args_in, "port", &i ) )
tr_sessionSetPublicPort( h, i );
tr_sessionSetPeerPort( h, i );
if( tr_bencDictFindInt( args_in, "port-forwarding-enabled", &i ) )
tr_sessionSetPortForwardingEnabled( h, i );
if( tr_bencDictFindInt( args_in, "speed-limit-down", &i ) )
@ -630,7 +630,7 @@ sessionGet( tr_handle * h, tr_benc * args_in UNUSED, tr_benc * args_out )
tr_bencDictAddInt( d, "pex-allowed",
tr_sessionIsPexEnabled( h ) );
tr_bencDictAddInt( d, "port",
tr_sessionGetPublicPort( h ) );
tr_sessionGetPeerPort( h ) );
tr_bencDictAddInt( d, "port-forwarding-enabled",
tr_sessionIsPortForwardingEnabled( h ) );
tr_bencDictAddInt( d, "speed-limit-up",

View File

@ -300,7 +300,7 @@ tr_setBindPortImpl( void * vdata )
}
void
tr_sessionSetPublicPort( tr_handle * handle, int port )
tr_sessionSetPeerPort( tr_handle * handle, int port )
{
struct bind_port_data * data = tr_new( struct bind_port_data, 1 );
data->handle = handle;
@ -309,10 +309,10 @@ tr_sessionSetPublicPort( tr_handle * handle, int port )
}
int
tr_sessionGetPublicPort( const tr_handle * h )
tr_sessionGetPeerPort( const tr_handle * h )
{
assert( h != NULL );
return tr_sharedGetPublicPort( h->shared );
return tr_sharedGetPeerPort( h->shared );
}
tr_port_forwarding

View File

@ -464,7 +464,7 @@ torrentRealInit( tr_handle * h,
tr_peerMgrAddTorrent( h->peerMgr, tor );
if( !h->isPortSet )
tr_sessionSetPublicPort( h, TR_DEFAULT_PORT );
tr_sessionSetPeerPort( h, TR_DEFAULT_PORT );
assert( !tor->downloadedCur );
assert( !tor->uploadedCur );

View File

@ -21,7 +21,6 @@
#include "bencode.h"
#include "completion.h"
#include "net.h"
#include "port-forwarding.h"
#include "publish.h"
#include "torrent.h"
#include "tracker.h"
@ -587,7 +586,7 @@ buildTrackerRequestURI( const tr_tracker * t,
strchr(ann, '?') ? '&' : '?',
t->escaped,
t->peer_id,
tr_sharedGetPublicPort( t->session->shared ),
tr_sessionGetPeerPort( t->session ),
torrent->uploadedCur,
torrent->downloadedCur,
torrent->corruptCur,

View File

@ -277,9 +277,9 @@ void tr_sessionSetPortForwardingEnabled( tr_handle *, int enable );
int tr_sessionIsPortForwardingEnabled( const tr_handle * );
void tr_sessionSetPublicPort( tr_handle *, int );
void tr_sessionSetPeerPort( tr_handle *, int );
int tr_sessionGetPublicPort( const tr_handle * );
int tr_sessionGetPeerPort( const tr_handle * );
typedef enum
{

View File

@ -55,7 +55,7 @@
IBOutlet NSImageView * fPortStatusImage;
IBOutlet NSProgressIndicator * fPortStatusProgress;
NSTimer * fPortStatusTimer;
int fPublicPort, fNatStatus;
int fPeerPort, fNatStatus;
}
- (id) initWithHandle: (tr_handle *) handle;

View File

@ -248,9 +248,9 @@
{
int port = [sender intValue];
[fDefaults setInteger: port forKey: @"BindPort"];
tr_sessionSetPublicPort(fHandle, port);
tr_sessionSetPeerPort(fHandle, port);
fPublicPort = -1;
fPeerPort = -1;
[self updatePortStatus];
}
@ -265,12 +265,12 @@
- (void) updatePortStatus
{
const tr_port_forwarding fwd = tr_sessionGetPortForwarding(fHandle);
const int port = tr_sessionGetPublicPort(fHandle);
const int port = tr_sessionGetPeerPort(fHandle);
if (fNatStatus != fwd || fPublicPort != port )
if (fNatStatus != fwd || fPeerPort != port )
{
fNatStatus = fwd;
fPublicPort = port;
fPeerPort = port;
[fPortStatusField setStringValue: [NSLocalizedString(@"Checking port status", "Preferences -> Network -> port status")
stringByAppendingEllipsis]];
@ -282,7 +282,7 @@
[fPortChecker cancelProbe];
[fPortChecker release];
}
fPortChecker = [[PortChecker alloc] initForPort: fPublicPort withDelegate: self];
fPortChecker = [[PortChecker alloc] initForPort: fPeerPort withDelegate: self];
}
}