Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"type": "git"
},
"dfinity": {
"ref": "v0.5.2",
"ref": "v0.5.4",
"repo": "ssh://git@github.com/dfinity-lab/dfinity",
"rev": "a847ecc0bb8a1893f2cfb8d26dd31d69cb019eb6",
"rev": "a77551d2c630c2f30d18860bfb556ce46a0e8b08",
"type": "git"
},
"motoko": {
Expand Down
8 changes: 4 additions & 4 deletions src/dfx/src/actors/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ impl Replica {
"Replica Configuration (TOML):\n-----\n{}-----\n", config_toml
);

let use_port = config.http_handler.use_port;
let port = config.http_handler.port;
let write_port_to = config.http_handler.write_port_to.clone();
let replica_path = self.config.replica_path.to_path_buf();

Expand All @@ -123,7 +123,7 @@ impl Replica {
let handle = replica_start_thread(
logger,
config_toml,
use_port,
port,
write_port_to,
replica_path,
addr,
Expand Down Expand Up @@ -216,7 +216,7 @@ fn wait_for_child_or_receiver(
fn replica_start_thread(
logger: Logger,
config_toml: String,
use_port: Option<u16>,
port: Option<u16>,
write_port_to: Option<PathBuf>,
replica_path: PathBuf,
addr: Addr<Replica>,
Expand Down Expand Up @@ -246,7 +246,7 @@ fn replica_start_thread(
debug!(logger, "Starting replica...");
let mut child = cmd.spawn().expect("Could not start replica.");

let port = use_port.unwrap_or_else(|| {
let port = port.unwrap_or_else(|| {
Replica::wait_for_port_file(write_port_to.as_ref().unwrap()).unwrap()
});
addr.do_send(signals::ReplicaRestarted { port });
Expand Down
2 changes: 1 addition & 1 deletion src/dfx/src/commands/replica.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn get_config(env: &dyn Environment, args: &ArgMatches<'_>) -> DfxResult<Replica
let file = env.get_temp_dir().join("config").join("port.txt");
http_handler.write_port_to = Some(file);
} else {
http_handler.use_port = Some(port);
http_handler.port = Some(port);
};
let message_gas_limit = get_message_gas_limit(&config, args)?;
let round_gas_limit = get_round_gas_limit(&config, args)?;
Expand Down
8 changes: 4 additions & 4 deletions src/dfx/src/lib/replica_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::path::{Path, PathBuf};
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
pub struct HttpHandlerConfig {
/// Instructs the HTTP handler to use the specified port
pub use_port: Option<u16>,
pub port: Option<u16>,

/// Instructs the HTTP handler to bind to any open port and report the port
/// to the specified file.
Expand Down Expand Up @@ -62,7 +62,7 @@ impl ReplicaConfig {
ReplicaConfig {
http_handler: HttpHandlerConfig {
write_port_to: None,
use_port: None,
port: None,
},
scheduler: SchedulerConfig {
exec_gas: None,
Expand All @@ -82,13 +82,13 @@ impl ReplicaConfig {

#[allow(dead_code)]
pub fn with_port(&mut self, port: u16) -> &mut Self {
self.http_handler.use_port = Some(port);
self.http_handler.port = Some(port);
self.http_handler.write_port_to = None;
self
}

pub fn with_random_port(&mut self, write_port_to: &Path) -> &mut Self {
self.http_handler.use_port = None;
self.http_handler.port = None;
self.http_handler.write_port_to = Some(write_port_to.to_path_buf());
self
}
Expand Down