1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-22 15:24:46 -05:00

feat(cli/js/net): make rid on listener public (#5571)

This commit is contained in:
Peter Indiola 2020-06-09 00:24:51 +08:00 committed by GitHub
parent d907133944
commit 6236252c66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 0 deletions

View file

@ -1545,6 +1545,9 @@ declare namespace Deno {
/** Return the address of the `Listener`. */
readonly addr: Addr;
/** Return the rid of the `Listener`. */
readonly rid: number;
[Symbol.asyncIterator](): AsyncIterableIterator<Conn>;
}

View file

@ -26,6 +26,8 @@ export interface Listener extends AsyncIterable<Conn> {
addr: Addr;
rid: number;
[Symbol.asyncIterator](): AsyncIterableIterator<Conn>;
}

View file

@ -4,6 +4,7 @@ import {
assert,
assertEquals,
createResolvable,
assertNotEquals,
} from "./test_util.ts";
unitTest({ perms: { net: true } }, function netTcpListenClose(): void {
@ -11,6 +12,7 @@ unitTest({ perms: { net: true } }, function netTcpListenClose(): void {
assert(listener.addr.transport === "tcp");
assertEquals(listener.addr.hostname, "127.0.0.1");
assertEquals(listener.addr.port, 3500);
assertNotEquals(listener.rid, 0);
listener.close();
});