diff options
author | J2P <jjp5023@gmail.com> | 2018-10-11 00:59:36 +0900 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-10-10 12:21:01 -0400 |
commit | c99207bf3976bfd3c5c3ef91d782c86f933977e6 (patch) | |
tree | c47619537a1cc7f1135555ef8664ab3946be3c78 /js/net.ts | |
parent | 7cc9b64ff7be3744897de53adf898ca78e9a3a4e (diff) |
Rename fd to rid
Diffstat (limited to 'js/net.ts')
-rw-r--r-- | js/net.ts | 22 |
1 files changed, 11 insertions, 11 deletions
@@ -28,12 +28,12 @@ export interface Listener { } class ListenerImpl implements Listener { - constructor(readonly fd: number) {} + constructor(readonly rid: number) {} async accept(): Promise<Conn> { const builder = new flatbuffers.Builder(); msg.Accept.startAccept(builder); - msg.Accept.addRid(builder, this.fd); + msg.Accept.addRid(builder, this.rid); const inner = msg.Accept.endAccept(builder); const baseRes = await dispatch.sendAsync(builder, msg.Any.Accept, inner); assert(baseRes != null); @@ -44,7 +44,7 @@ class ListenerImpl implements Listener { } close(): void { - close(this.fd); + close(this.rid); } addr(): Addr { @@ -61,35 +61,35 @@ export interface Conn extends Reader, Writer, Closer { class ConnImpl implements Conn { constructor( - readonly fd: number, + readonly rid: number, readonly remoteAddr: string, readonly localAddr: string ) {} write(p: ArrayBufferView): Promise<number> { - return write(this.fd, p); + return write(this.rid, p); } read(p: ArrayBufferView): Promise<ReadResult> { - return read(this.fd, p); + return read(this.rid, p); } close(): void { - close(this.fd); + close(this.rid); } /** closeRead shuts down (shutdown(2)) the reading side of the TCP connection. * Most callers should just use close(). */ closeRead(): void { - shutdown(this.fd, ShutdownMode.Read); + shutdown(this.rid, ShutdownMode.Read); } /** closeWrite shuts down (shutdown(2)) the writing side of the TCP * connection. Most callers should just use close(). */ closeWrite(): void { - shutdown(this.fd, ShutdownMode.Write); + shutdown(this.rid, ShutdownMode.Write); } } @@ -101,10 +101,10 @@ enum ShutdownMode { ReadWrite // unused } -function shutdown(fd: number, how: ShutdownMode) { +function shutdown(rid: number, how: ShutdownMode) { const builder = new flatbuffers.Builder(); msg.Shutdown.startShutdown(builder); - msg.Shutdown.addRid(builder, fd); + msg.Shutdown.addRid(builder, rid); msg.Shutdown.addHow(builder, how); const inner = msg.Shutdown.endShutdown(builder); const baseRes = dispatch.sendSync(builder, msg.Any.Shutdown, inner); |