@bytecodealliance/preview3-shim 0.3.1 → 0.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -308,14 +308,11 @@ async function handleTcpConnect({ socketId, remoteAddress }) {
|
|
|
308
308
|
allowHalfOpen: true
|
|
309
309
|
});
|
|
310
310
|
const onConnect = once(tcp, "connect");
|
|
311
|
-
const onError = once(tcp, "error").then(([err]) => {
|
|
312
|
-
throw err;
|
|
313
|
-
});
|
|
314
311
|
tcp.connect({
|
|
315
312
|
port,
|
|
316
313
|
host
|
|
317
314
|
});
|
|
318
|
-
await
|
|
315
|
+
await onConnect;
|
|
319
316
|
}
|
|
320
317
|
async function handleTcpListen({ socketId, stream }) {
|
|
321
318
|
const writer = stream.getWriter();
|
|
@@ -326,11 +323,8 @@ async function handleTcpListen({ socketId, stream }) {
|
|
|
326
323
|
allowHalfOpen: true
|
|
327
324
|
});
|
|
328
325
|
const onListening = once(server, "listening");
|
|
329
|
-
const onError = once(server, "error").then(([err]) => {
|
|
330
|
-
throw err;
|
|
331
|
-
});
|
|
332
326
|
server.listen(handle, backlog);
|
|
333
|
-
await
|
|
327
|
+
await onListening;
|
|
334
328
|
const addr = server.address();
|
|
335
329
|
if (addr && typeof addr === "object") socket.localAddress = makeIpAddress(family, addr.address, addr.port);
|
|
336
330
|
server.on("connection", (conn) => {
|
|
@@ -91,13 +91,14 @@ async function handleTcpConnect({ socketId, remoteAddress }) {
|
|
|
91
91
|
pauseOnCreate: true,
|
|
92
92
|
allowHalfOpen: true,
|
|
93
93
|
}));
|
|
94
|
-
const onConnect = once(tcp, "connect");
|
|
95
|
-
const onError = once(tcp, "error").then(([err]) => {
|
|
96
|
-
throw err;
|
|
97
|
-
});
|
|
98
94
|
// TODO(tandr): Add lookup
|
|
95
|
+
const onConnect = once(tcp, "connect");
|
|
99
96
|
tcp.connect({ port, host });
|
|
100
|
-
|
|
97
|
+
// events.once rejects when the emitter produces an error while waiting and
|
|
98
|
+
// removes its temporary listeners after settling. A separate error promise
|
|
99
|
+
// would remain attached after a successful connect and could later reject
|
|
100
|
+
// unobserved when an established connection is reset.
|
|
101
|
+
await onConnect;
|
|
101
102
|
}
|
|
102
103
|
async function handleTcpListen({ socketId, stream }) {
|
|
103
104
|
const writer = stream.getWriter();
|
|
@@ -108,11 +109,8 @@ async function handleTcpListen({ socketId, stream }) {
|
|
|
108
109
|
allowHalfOpen: true,
|
|
109
110
|
});
|
|
110
111
|
const onListening = once(server, "listening");
|
|
111
|
-
const onError = once(server, "error").then(([err]) => {
|
|
112
|
-
throw err;
|
|
113
|
-
});
|
|
114
112
|
server.listen(handle, backlog);
|
|
115
|
-
await
|
|
113
|
+
await onListening;
|
|
116
114
|
const addr = server.address();
|
|
117
115
|
if (addr && typeof addr === "object") {
|
|
118
116
|
socket.localAddress = makeIpAddress(family, addr.address, addr.port);
|
package/package.json
CHANGED