Skip to content

Commit 255411e

Browse files
iuioiuasatyarohith
authored andcommitted
FUTURE(ext/net): remove Deno.(Conn|TlsConn|Listener|TlsListener|UnixConn).prototype.rid (#23219)
Towards #23089 --------- Signed-off-by: Asher Gomez <[email protected]>
1 parent f05b029 commit 255411e

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

ext/net/01_net.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,12 @@ class Conn {
100100
#writable;
101101

102102
constructor(rid, remoteAddr, localAddr) {
103+
if (internals.future) {
104+
ObjectDefineProperty(this, "rid", {
105+
enumerable: false,
106+
value: undefined,
107+
});
108+
}
103109
ObjectDefineProperty(this, internalRidSymbol, {
104110
enumerable: false,
105111
value: rid,
@@ -260,6 +266,12 @@ class Listener {
260266
#promise = null;
261267

262268
constructor(rid, addr) {
269+
if (internals.future) {
270+
ObjectDefineProperty(this, "rid", {
271+
enumerable: false,
272+
value: undefined,
273+
});
274+
}
263275
ObjectDefineProperty(this, internalRidSymbol, {
264276
enumerable: false,
265277
value: rid,

tests/specs/future/runtime_api/main.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,47 @@ console.log("Deno.writeAllSync is", Deno.writeAllSync);
3131
console.log("Deno.write is", Deno.write);
3232
console.log("Deno.writeSync is", Deno.writeSync);
3333

34+
// TCP
35+
// Since these tests may run in parallel, ensure this port is unique to this file
36+
const tcpPort = 4509;
37+
const tcpListener = Deno.listen({ port: tcpPort });
38+
console.log("Deno.Listener.prototype.rid is", tcpListener.rid);
39+
40+
const tcpConn = await Deno.connect({ port: tcpPort });
41+
console.log("Deno.Conn.prototype.rid is", tcpConn.rid);
42+
43+
tcpConn.close();
44+
tcpListener.close();
45+
46+
// Unix
47+
if (Deno.build.os === "windows") {
48+
console.log("Deno.UnixConn.prototype.rid is undefined");
49+
} else {
50+
const socketPath = "./test.sock";
51+
const unixListener = Deno.listen({ transport: "unix", path: socketPath });
52+
53+
const unixConn = await Deno.connect({ transport: "unix", path: socketPath });
54+
console.log("Deno.UnixConn.prototype.rid is", unixConn.rid);
55+
56+
unixConn.close();
57+
unixListener.close();
58+
Deno.removeSync(socketPath);
59+
}
60+
61+
// TLS
62+
// Since these tests may run in parallel, ensure this port is unique to this file
63+
const tlsPort = 4510;
64+
const cert = Deno.readTextFileSync("../../../testdata/tls/localhost.crt");
65+
const key = Deno.readTextFileSync("../../../testdata/tls/localhost.key");
66+
const tlsListener = Deno.listenTls({ port: tlsPort, cert, key });
67+
console.log("Deno.TlsListener.prototype.rid is", tlsListener.rid);
68+
69+
const tlsConn = await Deno.connectTls({ port: tlsPort });
70+
console.log("Deno.TlsConn.prototype.rid is", tlsConn.rid);
71+
72+
tlsConn.close();
73+
tlsListener.close();
74+
3475
const watcher = Deno.watchFs(".");
3576
console.log("Deno.FsWatcher.prototype.rid is", watcher.rid);
3677
watcher.close();

tests/specs/future/runtime_api/main.out

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,10 @@ Deno.writeAll is undefined
2727
Deno.writeAllSync is undefined
2828
Deno.write is undefined
2929
Deno.writeSync is undefined
30+
Deno.Listener.prototype.rid is undefined
31+
Deno.Conn.prototype.rid is undefined
32+
Deno.UnixConn.prototype.rid is undefined
33+
Deno.TlsListener.prototype.rid is undefined
34+
Deno.TlsConn.prototype.rid is undefined
3035
Deno.FsWatcher.prototype.rid is undefined
3136
Deno.FsFile constructor is illegal

0 commit comments

Comments
 (0)