Chromium Code Reviews| Index: remoting/host/plugin/host_script_object.cc |
| diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc |
| index 1f83dcde3c6b5cac3e911324757c444b62f31c6a..917a252a5bbf0f8515a9166f7dd9964de07db763 100644 |
| --- a/remoting/host/plugin/host_script_object.cc |
| +++ b/remoting/host/plugin/host_script_object.cc |
| @@ -74,6 +74,9 @@ const char* kAttrNameError = "ERROR"; |
| const int kMaxLoginAttempts = 5; |
| +const int kMinPortNumber = 12400; |
|
Sergey Ulanov
2012/08/22 23:50:34
Maybe put these values somewhere where they can be
Wez
2012/08/23 23:26:26
Done.
|
| +const int kMaxPortNumber = 12409; |
| + |
| // We may need to have more than one task running at the same time |
| // (e.g. key generation and status update), yet unlikely to ever need |
| // more than 2 threads. |
| @@ -576,15 +579,22 @@ void HostNPScriptObject::FinishConnectNetworkThread( |
| signal_strategy_.reset(signal_strategy.release()); |
| register_request_.reset(register_request.release()); |
| - // Create the Host. |
| + // If NAT traversal is off then limit port range to allow firewall pin-holing. |
| LOG(INFO) << "NAT state: " << nat_traversal_enabled_; |
| + NetworkSettings network_settings( |
| + nat_traversal_enabled_ ? |
| + NetworkSettings::NAT_TRAVERSAL_ENABLED : |
| + NetworkSettings::NAT_TRAVERSAL_DISABLED); |
| + if (!nat_traversal_enabled_) { |
| + network_settings.min_port = kMinPortNumber; |
| + network_settings.max_port = kMaxPortNumber; |
| + } |
| + |
| + // Create the Host. |
| host_ = new ChromotingHost( |
| host_context_.get(), signal_strategy_.get(), desktop_environment_.get(), |
| - CreateHostSessionManager( |
| - NetworkSettings(nat_traversal_enabled_ ? |
| - NetworkSettings::NAT_TRAVERSAL_ENABLED : |
| - NetworkSettings::NAT_TRAVERSAL_DISABLED), |
| - host_context_->url_request_context_getter())); |
| + CreateHostSessionManager(network_settings, |
| + host_context_->url_request_context_getter())); |
| host_->AddStatusObserver(this); |
| log_to_server_.reset( |
| new LogToServer(host_, ServerLogEntry::IT2ME, signal_strategy_.get())); |