mirror of
https://github.com/denoland/deno.git
synced 2024-11-22 15:06:54 -05:00
Use underscores in filenames.
This commit is contained in:
parent
818ad37678
commit
2f44db6756
11 changed files with 48 additions and 48 deletions
4
BUILD.gn
4
BUILD.gn
|
@ -76,9 +76,9 @@ ts_sources = [
|
||||||
"js/dom_types.ts",
|
"js/dom_types.ts",
|
||||||
"js/errors.ts",
|
"js/errors.ts",
|
||||||
"js/fetch.ts",
|
"js/fetch.ts",
|
||||||
"js/fileinfo.ts",
|
"js/file_info.ts",
|
||||||
"js/files.ts",
|
"js/files.ts",
|
||||||
"js/global-eval.ts",
|
"js/global_eval.ts",
|
||||||
"js/globals.ts",
|
"js/globals.ts",
|
||||||
"js/io.ts",
|
"js/io.ts",
|
||||||
"js/libdeno.ts",
|
"js/libdeno.ts",
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
import * as ts from "typescript";
|
import * as ts from "typescript";
|
||||||
import { assetSourceCode } from "./assets";
|
import { assetSourceCode } from "./assets";
|
||||||
import * as deno from "./deno";
|
import * as deno from "./deno";
|
||||||
import { globalEval } from "./global-eval";
|
import { globalEval } from "./global_eval";
|
||||||
import { libdeno } from "./libdeno";
|
import { libdeno } from "./libdeno";
|
||||||
import { window } from "./globals";
|
import { window } from "./globals";
|
||||||
import * as os from "./os";
|
import * as os from "./os";
|
||||||
|
|
|
@ -20,6 +20,6 @@ export { libdeno } from "./libdeno";
|
||||||
export { platform } from "./platform";
|
export { platform } from "./platform";
|
||||||
export { trace } from "./trace";
|
export { trace } from "./trace";
|
||||||
export { truncateSync, truncate } from "./truncate";
|
export { truncateSync, truncate } from "./truncate";
|
||||||
export { FileInfo } from "./fileinfo";
|
export { FileInfo } from "./file_info";
|
||||||
export { connect, dial, listen, Listener, Conn } from "./net";
|
export { connect, dial, listen, Listener, Conn } from "./net";
|
||||||
export const args: string[] = [];
|
export const args: string[] = [];
|
||||||
|
|
|
@ -5,7 +5,7 @@ import * as timers from "./timers";
|
||||||
import * as textEncoding from "./text_encoding";
|
import * as textEncoding from "./text_encoding";
|
||||||
import * as fetch_ from "./fetch";
|
import * as fetch_ from "./fetch";
|
||||||
import { libdeno } from "./libdeno";
|
import { libdeno } from "./libdeno";
|
||||||
import { globalEval } from "./global-eval";
|
import { globalEval } from "./global_eval";
|
||||||
import { DenoHeaders } from "./fetch";
|
import { DenoHeaders } from "./fetch";
|
||||||
import { DenoBlob } from "./blob";
|
import { DenoBlob } from "./blob";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { RawSourceMap } from "./types";
|
import { RawSourceMap } from "./types";
|
||||||
import { globalEval } from "./global-eval";
|
import { globalEval } from "./global_eval";
|
||||||
|
|
||||||
// The libdeno functions are moved so that users can't access them.
|
// The libdeno functions are moved so that users can't access them.
|
||||||
type MessageCallback = (msg: Uint8Array) => void;
|
type MessageCallback = (msg: Uint8Array) => void;
|
||||||
|
|
48
js/net.ts
48
js/net.ts
|
@ -1,7 +1,7 @@
|
||||||
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
// Copyright 2018 the Deno authors. All rights reserved. MIT license.
|
||||||
|
|
||||||
import { ReadResult, Reader, Writer, Closer } from "./io";
|
import { ReadResult, Reader, Writer, Closer } from "./io";
|
||||||
import * as fbs from "gen/msg_generated";
|
import * as msg from "gen/msg_generated";
|
||||||
import { assert, notImplemented } from "./util";
|
import { assert, notImplemented } from "./util";
|
||||||
import * as dispatch from "./dispatch";
|
import * as dispatch from "./dispatch";
|
||||||
import { flatbuffers } from "flatbuffers";
|
import { flatbuffers } from "flatbuffers";
|
||||||
|
@ -32,14 +32,14 @@ class ListenerImpl implements Listener {
|
||||||
|
|
||||||
async accept(): Promise<Conn> {
|
async accept(): Promise<Conn> {
|
||||||
const builder = new flatbuffers.Builder();
|
const builder = new flatbuffers.Builder();
|
||||||
fbs.Accept.startAccept(builder);
|
msg.Accept.startAccept(builder);
|
||||||
fbs.Accept.addRid(builder, this.fd);
|
msg.Accept.addRid(builder, this.fd);
|
||||||
const msg = fbs.Accept.endAccept(builder);
|
const inner = msg.Accept.endAccept(builder);
|
||||||
const baseRes = await dispatch.sendAsync(builder, fbs.Any.Accept, msg);
|
const baseRes = await dispatch.sendAsync(builder, msg.Any.Accept, inner);
|
||||||
assert(baseRes != null);
|
assert(baseRes != null);
|
||||||
assert(fbs.Any.NewConn === baseRes!.msgType());
|
assert(msg.Any.NewConn === baseRes!.innerType());
|
||||||
const res = new fbs.NewConn();
|
const res = new msg.NewConn();
|
||||||
assert(baseRes!.msg(res) != null);
|
assert(baseRes!.inner(res) != null);
|
||||||
return new ConnImpl(res.rid(), res.remoteAddr()!, res.localAddr()!);
|
return new ConnImpl(res.rid(), res.remoteAddr()!, res.localAddr()!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,15 +112,15 @@ export function listen(network: Network, address: string): Listener {
|
||||||
const builder = new flatbuffers.Builder();
|
const builder = new flatbuffers.Builder();
|
||||||
const network_ = builder.createString(network);
|
const network_ = builder.createString(network);
|
||||||
const address_ = builder.createString(address);
|
const address_ = builder.createString(address);
|
||||||
fbs.Listen.startListen(builder);
|
msg.Listen.startListen(builder);
|
||||||
fbs.Listen.addNetwork(builder, network_);
|
msg.Listen.addNetwork(builder, network_);
|
||||||
fbs.Listen.addAddress(builder, address_);
|
msg.Listen.addAddress(builder, address_);
|
||||||
const msg = fbs.Listen.endListen(builder);
|
const inner = msg.Listen.endListen(builder);
|
||||||
const baseRes = dispatch.sendSync(builder, fbs.Any.Listen, msg);
|
const baseRes = dispatch.sendSync(builder, msg.Any.Listen, inner);
|
||||||
assert(baseRes != null);
|
assert(baseRes != null);
|
||||||
assert(fbs.Any.ListenRes === baseRes!.msgType());
|
assert(msg.Any.ListenRes === baseRes!.innerType());
|
||||||
const res = new fbs.ListenRes();
|
const res = new msg.ListenRes();
|
||||||
assert(baseRes!.msg(res) != null);
|
assert(baseRes!.inner(res) != null);
|
||||||
return new ListenerImpl(res.rid());
|
return new ListenerImpl(res.rid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -154,15 +154,15 @@ export async function dial(network: Network, address: string): Promise<Conn> {
|
||||||
const builder = new flatbuffers.Builder();
|
const builder = new flatbuffers.Builder();
|
||||||
const network_ = builder.createString(network);
|
const network_ = builder.createString(network);
|
||||||
const address_ = builder.createString(address);
|
const address_ = builder.createString(address);
|
||||||
fbs.Dial.startDial(builder);
|
msg.Dial.startDial(builder);
|
||||||
fbs.Dial.addNetwork(builder, network_);
|
msg.Dial.addNetwork(builder, network_);
|
||||||
fbs.Dial.addAddress(builder, address_);
|
msg.Dial.addAddress(builder, address_);
|
||||||
const msg = fbs.Dial.endDial(builder);
|
const inner = msg.Dial.endDial(builder);
|
||||||
const baseRes = await dispatch.sendAsync(builder, fbs.Any.Dial, msg);
|
const baseRes = await dispatch.sendAsync(builder, msg.Any.Dial, inner);
|
||||||
assert(baseRes != null);
|
assert(baseRes != null);
|
||||||
assert(fbs.Any.NewConn === baseRes!.msgType());
|
assert(msg.Any.NewConn === baseRes!.innerType());
|
||||||
const res = new fbs.NewConn();
|
const res = new msg.NewConn();
|
||||||
assert(baseRes!.msg(res) != null);
|
assert(baseRes!.inner(res) != null);
|
||||||
return new ConnImpl(res.rid(), res.remoteAddr()!, res.localAddr()!);
|
return new ConnImpl(res.rid(), res.remoteAddr()!, res.localAddr()!);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import * as msg from "gen/msg_generated";
|
import * as msg from "gen/msg_generated";
|
||||||
import { flatbuffers } from "flatbuffers";
|
import { flatbuffers } from "flatbuffers";
|
||||||
import * as dispatch from "./dispatch";
|
import * as dispatch from "./dispatch";
|
||||||
import { FileInfo, FileInfoImpl } from "./fileinfo";
|
import { FileInfo, FileInfoImpl } from "./file_info";
|
||||||
import { assert } from "./util";
|
import { assert } from "./util";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,7 +3,7 @@ import * as msg from "gen/msg_generated";
|
||||||
import { flatbuffers } from "flatbuffers";
|
import { flatbuffers } from "flatbuffers";
|
||||||
import * as dispatch from "./dispatch";
|
import * as dispatch from "./dispatch";
|
||||||
import { assert } from "./util";
|
import { assert } from "./util";
|
||||||
import { FileInfo, FileInfoImpl } from "./fileinfo";
|
import { FileInfo, FileInfoImpl } from "./file_info";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Queries the file system for information on the path provided.
|
* Queries the file system for information on the path provided.
|
||||||
|
|
32
src/ops.rs
32
src/ops.rs
|
@ -600,8 +600,8 @@ fn op_close(
|
||||||
data: &'static mut [u8],
|
data: &'static mut [u8],
|
||||||
) -> Box<Op> {
|
) -> Box<Op> {
|
||||||
assert_eq!(data.len(), 0);
|
assert_eq!(data.len(), 0);
|
||||||
let msg = base.msg_as_close().unwrap();
|
let inner = base.inner_as_close().unwrap();
|
||||||
let rid = msg.rid();
|
let rid = inner.rid();
|
||||||
match resources::lookup(rid) {
|
match resources::lookup(rid) {
|
||||||
None => odd_future(errors::new(
|
None => odd_future(errors::new(
|
||||||
errors::ErrorKind::BadFileDescriptor,
|
errors::ErrorKind::BadFileDescriptor,
|
||||||
|
@ -1039,10 +1039,10 @@ fn op_listen(
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmd_id = base.cmd_id();
|
let cmd_id = base.cmd_id();
|
||||||
let msg = base.msg_as_listen().unwrap();
|
let inner = base.inner_as_listen().unwrap();
|
||||||
let network = msg.network().unwrap();
|
let network = inner.network().unwrap();
|
||||||
assert_eq!(network, "tcp");
|
assert_eq!(network, "tcp");
|
||||||
let address = msg.address().unwrap();
|
let address = inner.address().unwrap();
|
||||||
|
|
||||||
Box::new(futures::future::result((move || {
|
Box::new(futures::future::result((move || {
|
||||||
// TODO properly parse addr
|
// TODO properly parse addr
|
||||||
|
@ -1052,7 +1052,7 @@ fn op_listen(
|
||||||
let resource = resources::add_tcp_listener(listener);
|
let resource = resources::add_tcp_listener(listener);
|
||||||
|
|
||||||
let builder = &mut FlatBufferBuilder::new();
|
let builder = &mut FlatBufferBuilder::new();
|
||||||
let msg = msg::ListenRes::create(
|
let inner = msg::ListenRes::create(
|
||||||
builder,
|
builder,
|
||||||
&msg::ListenResArgs {
|
&msg::ListenResArgs {
|
||||||
rid: resource.rid,
|
rid: resource.rid,
|
||||||
|
@ -1063,8 +1063,8 @@ fn op_listen(
|
||||||
cmd_id,
|
cmd_id,
|
||||||
builder,
|
builder,
|
||||||
msg::BaseArgs {
|
msg::BaseArgs {
|
||||||
msg: Some(msg.as_union_value()),
|
inner: Some(inner.as_union_value()),
|
||||||
msg_type: msg::Any::ListenRes,
|
inner_type: msg::Any::ListenRes,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
@ -1076,7 +1076,7 @@ fn new_conn(cmd_id: u32, tcp_stream: TcpStream) -> OpResult {
|
||||||
// TODO forward socket_addr to client.
|
// TODO forward socket_addr to client.
|
||||||
|
|
||||||
let builder = &mut FlatBufferBuilder::new();
|
let builder = &mut FlatBufferBuilder::new();
|
||||||
let msg = msg::NewConn::create(
|
let inner = msg::NewConn::create(
|
||||||
builder,
|
builder,
|
||||||
&msg::NewConnArgs {
|
&msg::NewConnArgs {
|
||||||
rid: tcp_stream_resource.rid,
|
rid: tcp_stream_resource.rid,
|
||||||
|
@ -1087,8 +1087,8 @@ fn new_conn(cmd_id: u32, tcp_stream: TcpStream) -> OpResult {
|
||||||
cmd_id,
|
cmd_id,
|
||||||
builder,
|
builder,
|
||||||
msg::BaseArgs {
|
msg::BaseArgs {
|
||||||
msg: Some(msg.as_union_value()),
|
inner: Some(inner.as_union_value()),
|
||||||
msg_type: msg::Any::NewConn,
|
inner_type: msg::Any::NewConn,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
))
|
))
|
||||||
|
@ -1105,8 +1105,8 @@ fn op_accept(
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmd_id = base.cmd_id();
|
let cmd_id = base.cmd_id();
|
||||||
let msg = base.msg_as_accept().unwrap();
|
let inner = base.inner_as_accept().unwrap();
|
||||||
let server_rid = msg.rid();
|
let server_rid = inner.rid();
|
||||||
|
|
||||||
match resources::lookup(server_rid) {
|
match resources::lookup(server_rid) {
|
||||||
None => odd_future(errors::new(
|
None => odd_future(errors::new(
|
||||||
|
@ -1135,10 +1135,10 @@ fn op_dial(
|
||||||
}
|
}
|
||||||
|
|
||||||
let cmd_id = base.cmd_id();
|
let cmd_id = base.cmd_id();
|
||||||
let msg = base.msg_as_dial().unwrap();
|
let inner = base.inner_as_dial().unwrap();
|
||||||
let network = msg.network().unwrap();
|
let network = inner.network().unwrap();
|
||||||
assert_eq!(network, "tcp");
|
assert_eq!(network, "tcp");
|
||||||
let address = msg.address().unwrap();
|
let address = inner.address().unwrap();
|
||||||
|
|
||||||
// TODO properly parse addr
|
// TODO properly parse addr
|
||||||
let addr = SocketAddr::from_str(address).unwrap();
|
let addr = SocketAddr::from_str(address).unwrap();
|
||||||
|
|
Loading…
Reference in a new issue