mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
when hibernating, don't advertise any ports
this is important for the dirport, because clients will still ask you for a directory, and they'll be sad when you're down. and do the other ports too, because hey, they're not listening. svn:r3133
This commit is contained in:
parent
a0a80ce2db
commit
464338b250
@ -151,8 +151,6 @@ void router_set_bandwidth_capacity(int bw) {
|
||||
}
|
||||
/** Return the value we tucked away above, or zero by default. */
|
||||
int router_get_bandwidth_capacity(void) {
|
||||
if (we_are_hibernating())
|
||||
return 0;
|
||||
return bw_capacity;
|
||||
}
|
||||
|
||||
@ -535,6 +533,7 @@ int router_rebuild_descriptor(int force) {
|
||||
uint32_t addr;
|
||||
char platform[256];
|
||||
struct in_addr in;
|
||||
int hibernating = we_are_hibernating();
|
||||
or_options_t *options = get_options();
|
||||
|
||||
if (!desc_is_dirty && !force)
|
||||
@ -550,9 +549,9 @@ int router_rebuild_descriptor(int force) {
|
||||
ri->address = tor_strdup(inet_ntoa(in));
|
||||
ri->nickname = tor_strdup(options->Nickname);
|
||||
ri->addr = addr;
|
||||
ri->or_port = options->ORPort;
|
||||
ri->socks_port = options->SocksPort;
|
||||
ri->dir_port = options->DirPort;
|
||||
ri->or_port = hibernating ? 0 : options->ORPort;
|
||||
ri->socks_port = hibernating ? 0 : options->SocksPort;
|
||||
ri->dir_port = hibernating ? 0 : options->DirPort;
|
||||
ri->published_on = time(NULL);
|
||||
ri->onion_pkey = crypto_pk_dup_key(get_onion_key()); /* must invoke from main thread */
|
||||
ri->identity_pkey = crypto_pk_dup_key(get_identity_key());
|
||||
@ -564,7 +563,7 @@ int router_rebuild_descriptor(int force) {
|
||||
ri->platform = tor_strdup(platform);
|
||||
ri->bandwidthrate = (int)options->BandwidthRate;
|
||||
ri->bandwidthburst = (int)options->BandwidthBurst;
|
||||
ri->bandwidthcapacity = router_get_bandwidth_capacity();
|
||||
ri->bandwidthcapacity = hibernating ? 0 : router_get_bandwidth_capacity();
|
||||
router_add_exit_policy_from_config(ri);
|
||||
if (desc_routerinfo) /* inherit values */
|
||||
ri->is_verified = desc_routerinfo->is_verified;
|
||||
|
Loading…
Reference in New Issue
Block a user