rt: Add rust_dbg_next_port for generating test port numbers
This commit is contained in:
parent
6a5c4f68c2
commit
1f97e6d47f
2 changed files with 12 additions and 1 deletions
|
@ -165,3 +165,14 @@ extern "C" CDECL TwoDoubles
|
||||||
rust_dbg_extern_identity_TwoDoubles(TwoDoubles u) {
|
rust_dbg_extern_identity_TwoDoubles(TwoDoubles u) {
|
||||||
return u;
|
return u;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generates increasing port numbers for network testing
|
||||||
|
extern "C" CDECL uintptr_t
|
||||||
|
rust_dbg_next_port() {
|
||||||
|
static lock_and_signal dbg_port_lock;
|
||||||
|
static uintptr_t next_port = 9000;
|
||||||
|
scoped_lock with(dbg_port_lock);
|
||||||
|
uintptr_t this_port = next_port;
|
||||||
|
next_port += 1;
|
||||||
|
return this_port;
|
||||||
|
}
|
||||||
|
|
|
@ -221,4 +221,4 @@ rust_uv_free_ip4_addr
|
||||||
rust_uv_free_ip6_addr
|
rust_uv_free_ip6_addr
|
||||||
rust_call_nullary_fn
|
rust_call_nullary_fn
|
||||||
rust_initialize_global_state
|
rust_initialize_global_state
|
||||||
|
rust_dbg_next_port
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue