1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-21 15:04:11 -05:00

BREAKING(net): remove Deno.{Conn,TlsConn,TcpConn,UnixConn}.prototype.rid (#25446)

Towards #22079

---------

Signed-off-by: Asher Gomez <ashersaupingomez@gmail.com>
This commit is contained in:
Asher Gomez 2024-09-07 09:01:36 +10:00 committed by GitHub
parent 5bac4075c3
commit a9ed06b832
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 1 additions and 122 deletions

View file

@ -101,13 +101,6 @@ class Conn {
#writable; #writable;
constructor(rid, remoteAddr, localAddr) { constructor(rid, remoteAddr, localAddr) {
if (internals.future) {
ObjectDefineProperty(this, "rid", {
__proto__: null,
enumerable: false,
value: undefined,
});
}
ObjectDefineProperty(this, internalRidSymbol, { ObjectDefineProperty(this, internalRidSymbol, {
__proto__: null, __proto__: null,
enumerable: false, enumerable: false,
@ -118,15 +111,6 @@ class Conn {
this.#localAddr = localAddr; this.#localAddr = localAddr;
} }
get rid() {
internals.warnOnDeprecatedApi(
"Deno.Conn.rid",
new Error().stack,
"Use `Deno.Conn` instance methods instead.",
);
return this.#rid;
}
get remoteAddr() { get remoteAddr() {
return this.#remoteAddr; return this.#remoteAddr;
} }
@ -223,15 +207,6 @@ class TcpConn extends Conn {
this.#rid = rid; this.#rid = rid;
} }
get rid() {
internals.warnOnDeprecatedApi(
"Deno.TcpConn.rid",
new Error().stack,
"Use `Deno.TcpConn` instance methods instead.",
);
return this.#rid;
}
setNoDelay(noDelay = true) { setNoDelay(noDelay = true) {
return op_set_nodelay(this.#rid, noDelay); return op_set_nodelay(this.#rid, noDelay);
} }
@ -253,15 +228,6 @@ class UnixConn extends Conn {
}); });
this.#rid = rid; this.#rid = rid;
} }
get rid() {
internals.warnOnDeprecatedApi(
"Deno.UnixConn.rid",
new Error().stack,
"Use `Deno.UnixConn` instance methods instead.",
);
return this.#rid;
}
} }
class Listener { class Listener {

View file

@ -37,15 +37,6 @@ class TlsConn extends Conn {
this.#rid = rid; this.#rid = rid;
} }
get rid() {
internals.warnOnDeprecatedApi(
"Deno.TlsConn.rid",
new Error().stack,
"Use `Deno.TlsConn` instance methods instead.",
);
return this.#rid;
}
handshake() { handshake() {
return op_tls_handshake(this.#rid); return op_tls_handshake(this.#rid);
} }

View file

@ -83,14 +83,6 @@ declare namespace Deno {
readonly localAddr: A; readonly localAddr: A;
/** The remote address of the connection. */ /** The remote address of the connection. */
readonly remoteAddr: A; readonly remoteAddr: A;
/**
* The resource ID of the connection.
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*/
readonly rid: number;
/** Shuts down (`shutdown(2)`) the write side of the connection. Most /** Shuts down (`shutdown(2)`) the write side of the connection. Most
* callers should just use `close()`. */ * callers should just use `close()`. */
closeWrite(): Promise<void>; closeWrite(): Promise<void>;
@ -123,14 +115,6 @@ declare namespace Deno {
* not happened yet. Calling this method is optional; the TLS handshake * not happened yet. Calling this method is optional; the TLS handshake
* will be completed automatically as soon as data is sent or received. */ * will be completed automatically as soon as data is sent or received. */
handshake(): Promise<TlsHandshakeInfo>; handshake(): Promise<TlsHandshakeInfo>;
/**
* The resource ID of the connection.
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*/
readonly rid: number;
} }
/** @category Network */ /** @category Network */
@ -359,14 +343,6 @@ declare namespace Deno {
setNoDelay(noDelay?: boolean): void; setNoDelay(noDelay?: boolean): void;
/** Enable/disable keep-alive functionality. */ /** Enable/disable keep-alive functionality. */
setKeepAlive(keepAlive?: boolean): void; setKeepAlive(keepAlive?: boolean): void;
/**
* The resource ID of the connection.
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*/
readonly rid: number;
} }
/** @category Network */ /** @category Network */
@ -376,16 +352,7 @@ declare namespace Deno {
} }
/** @category Network */ /** @category Network */
export interface UnixConn extends Conn<UnixAddr> { export interface UnixConn extends Conn<UnixAddr> {}
/**
* The resource ID of the connection.
*
* @deprecated This will be removed in Deno 2.0. See the
* {@link https://docs.deno.com/runtime/manual/advanced/migrate_deprecations | Deno 1.x to 2.x Migration Guide}
* for migration instructions.
*/
readonly rid: number;
}
/** Connects to the hostname (default is "127.0.0.1") and port on the named /** Connects to the hostname (default is "127.0.0.1") and port on the named
* transport (default is "tcp"), and resolves to the connection (`Conn`). * transport (default is "tcp"), and resolves to the connection (`Conn`).

View file

@ -9,28 +9,8 @@ console.log(
const tcpPort = 4509; const tcpPort = 4509;
const tcpListener = Deno.listen({ port: tcpPort }); const tcpListener = Deno.listen({ port: tcpPort });
console.log("Deno.Listener.prototype.rid is", tcpListener.rid); console.log("Deno.Listener.prototype.rid is", tcpListener.rid);
const tcpConn = await Deno.connect({ port: tcpPort });
console.log("Deno.Conn.prototype.rid is", tcpConn.rid);
tcpConn.close();
tcpListener.close(); tcpListener.close();
// Unix
if (Deno.build.os === "windows") {
console.log("Deno.UnixConn.prototype.rid is undefined");
} else {
const socketPath = "./test.sock";
const unixListener = Deno.listen({ transport: "unix", path: socketPath });
const unixConn = await Deno.connect({ transport: "unix", path: socketPath });
console.log("Deno.UnixConn.prototype.rid is", unixConn.rid);
unixConn.close();
unixListener.close();
Deno.removeSync(socketPath);
}
// TLS // TLS
// Since these tests may run in parallel, ensure this port is unique to this file // Since these tests may run in parallel, ensure this port is unique to this file
const tlsPort = 4510; const tlsPort = 4510;
@ -43,11 +23,6 @@ const key = Deno.readTextFileSync(
const tlsListener = Deno.listenTls({ port: tlsPort, cert, key }); const tlsListener = Deno.listenTls({ port: tlsPort, cert, key });
console.log("Deno.TlsListener.prototype.rid is", tlsListener.rid); console.log("Deno.TlsListener.prototype.rid is", tlsListener.rid);
const tlsConn = await Deno.connectTls({ port: tlsPort });
console.log("Deno.TlsConn.prototype.rid is", tlsConn.rid);
tlsConn.close();
try { try {
new Deno.FsFile(0); new Deno.FsFile(0);
} catch (error) { } catch (error) {

View file

@ -1,10 +1,7 @@
window is undefined window is undefined
Deno.FsFile.prototype.rid is undefined Deno.FsFile.prototype.rid is undefined
Deno.Listener.prototype.rid is undefined Deno.Listener.prototype.rid is undefined
Deno.Conn.prototype.rid is undefined
Deno.UnixConn.prototype.rid is undefined
Deno.TlsListener.prototype.rid is undefined Deno.TlsListener.prototype.rid is undefined
Deno.TlsConn.prototype.rid is undefined
Deno.FsFile constructor is illegal Deno.FsFile constructor is illegal
Deno.ConnectTlsOptions.(certFile|keyFile) do nothing Deno.ConnectTlsOptions.(certFile|keyFile) do nothing
Deno.ConnectTlsOptions.(certChain|privateKey) do nothing Deno.ConnectTlsOptions.(certChain|privateKey) do nothing

View file

@ -236,9 +236,6 @@ Deno.test({ permissions: { net: true } }, async function netTcpDialListen() {
assertEquals(1, buf[0]); assertEquals(1, buf[0]);
assertEquals(2, buf[1]); assertEquals(2, buf[1]);
assertEquals(3, buf[2]); assertEquals(3, buf[2]);
if (!DENO_FUTURE) {
assert(conn.rid > 0);
}
assert(readResult !== null); assert(readResult !== null);
@ -274,9 +271,6 @@ Deno.test({ permissions: { net: true } }, async function netTcpSetNoDelay() {
assertEquals(1, buf[0]); assertEquals(1, buf[0]);
assertEquals(2, buf[1]); assertEquals(2, buf[1]);
assertEquals(3, buf[2]); assertEquals(3, buf[2]);
if (!DENO_FUTURE) {
assert(conn.rid > 0);
}
assert(readResult !== null); assert(readResult !== null);
@ -312,9 +306,6 @@ Deno.test({ permissions: { net: true } }, async function netTcpSetKeepAlive() {
assertEquals(1, buf[0]); assertEquals(1, buf[0]);
assertEquals(2, buf[1]); assertEquals(2, buf[1]);
assertEquals(3, buf[2]); assertEquals(3, buf[2]);
if (!DENO_FUTURE) {
assert(conn.rid > 0);
}
assert(readResult !== null); assert(readResult !== null);
@ -352,9 +343,6 @@ Deno.test(
assertEquals(1, buf[0]); assertEquals(1, buf[0]);
assertEquals(2, buf[1]); assertEquals(2, buf[1]);
assertEquals(3, buf[2]); assertEquals(3, buf[2]);
if (!DENO_FUTURE) {
assert(conn.rid > 0);
}
assert(readResult !== null); assert(readResult !== null);
@ -850,9 +838,6 @@ Deno.test(
assertEquals(1, buf[0]); assertEquals(1, buf[0]);
assertEquals(2, buf[1]); assertEquals(2, buf[1]);
assertEquals(3, buf[2]); assertEquals(3, buf[2]);
if (!DENO_FUTURE) {
assert(conn.rid > 0);
}
assert(readResult !== null); assert(readResult !== null);

View file

@ -221,7 +221,6 @@ Deno.test(
); );
const conn = await Deno.connectTls({ hostname, port, caCerts }); const conn = await Deno.connectTls({ hostname, port, caCerts });
assert(DENO_FUTURE || conn.rid > 0);
const w = new BufWriter(conn); const w = new BufWriter(conn);
const r = new BufReader(conn); const r = new BufReader(conn);
const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`;
@ -273,7 +272,6 @@ Deno.test(
); );
const conn = await Deno.connectTls({ hostname, port, caCerts }); const conn = await Deno.connectTls({ hostname, port, caCerts });
assert(DENO_FUTURE || conn.rid > 0);
const w = new BufWriter(conn); const w = new BufWriter(conn);
const r = new BufReader(conn); const r = new BufReader(conn);
const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`; const body = `GET / HTTP/1.1\r\nHost: ${hostname}:${port}\r\n\r\n`;