Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): survive macOS setTypeOfService EINVAL #8389

ClosedMaWoo96(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8389/headopened View on GitHub

Showing 2 changed files with 85 additions and 2 deletions.

x
0 of 2 viewed, 2 left
43 additions and 1 deletionapps/server/src/bin.test.tsModified
View file
@@ -1,6 +1,7 @@
// @effect-diagnostics nodeBuiltinImport:off - CLI integration exercises Node HTTP and filesystem boundaries.
import * as NodeHttp from "node:http";
import * as NodeFS from "node:fs";
+import * as NodeNet from "node:net";
import * as NodeOS from "node:os";
import * as NodePath from "node:path";
​
@@ -25,7 +26,7 @@
import * as TestConsole from "effect/testing/TestConsole";
import { Command } from "effect/unstable/cli";
​
-import { cli, makeCli } from "./bin.ts";
+import { cli, guardSetTypeOfService, makeCli } from "./bin.ts";
import * as ServerConfig from "./config.ts";
import * as ProjectionSnapshotQuery from "./orchestration/Services/ProjectionSnapshotQuery.ts";
import * as OrchestrationEngine from "./orchestration/Services/OrchestrationEngine.ts";
@@ -53,6 +54,47 @@
const runCliWithRuntime = (args: ReadonlyArray<string>) =>
runCli(args).pipe(Effect.provide(CliRuntimeLayer));
​
+it("keeps setTypeOfService EINVAL from aborting HTTP requests", () => {
+ const socket = new NodeNet.Socket();
+ const invalidArgument = Object.assign(new Error("setTypeOfService EINVAL"), {
+ code: "EINVAL",
+ errno: -22,
+ syscall: "setTypeOfService",
+ });
+ const guarded = guardSetTypeOfService(function setTypeOfService(): never {