mirror of
https://github.com/denoland/deno.git
synced 2024-11-24 15:19:26 -05:00
bench: avoid port collision (#16285)
This commit is contained in:
parent
9c7a5c0c61
commit
8283d37c51
3 changed files with 5 additions and 4 deletions
|
@ -191,8 +191,9 @@ fn server_addr(port: u16) -> String {
|
|||
}
|
||||
|
||||
fn core_http_json_ops(exe: &str) -> Result<HttpBenchmarkResult> {
|
||||
// let port = get_port();
|
||||
println!("http_benchmark testing CORE http_bench_json_ops");
|
||||
run(&[exe], 4544, None, None, None)
|
||||
run(&[exe], 4570, None, None, None)
|
||||
}
|
||||
|
||||
fn hyper_http(exe: &str) -> Result<HttpBenchmarkResult> {
|
||||
|
|
|
@ -9,7 +9,7 @@ const responseBuf = new Uint8Array(
|
|||
.map((c) => c.charCodeAt(0)),
|
||||
);
|
||||
|
||||
/** Listens on 0.0.0.0:4500, returns rid. */
|
||||
/** Listens on 0.0.0.0:4570, returns rid. */
|
||||
function listen() {
|
||||
return Deno.core.ops.op_listen();
|
||||
}
|
||||
|
@ -38,7 +38,7 @@ async function serve(rid) {
|
|||
|
||||
async function main() {
|
||||
const listenerRid = listen();
|
||||
Deno.core.print(`http_bench_ops listening on http://127.0.0.1:4544/\n`);
|
||||
Deno.core.print(`http_bench_ops listening on http://127.0.0.1:4570/\n`);
|
||||
|
||||
while (true) {
|
||||
const rid = await accept(listenerRid);
|
||||
|
|
|
@ -130,7 +130,7 @@ fn create_js_runtime() -> JsRuntime {
|
|||
#[op]
|
||||
fn op_listen(state: &mut OpState) -> Result<ResourceId, Error> {
|
||||
log::debug!("listen");
|
||||
let addr = "127.0.0.1:4544".parse::<SocketAddr>().unwrap();
|
||||
let addr = "127.0.0.1:4570".parse::<SocketAddr>().unwrap();
|
||||
let std_listener = std::net::TcpListener::bind(&addr)?;
|
||||
std_listener.set_nonblocking(true)?;
|
||||
let listener = TcpListener::try_from(std_listener)?;
|
||||
|
|
Loading…
Reference in a new issue