totally mixces
totally mixces•9mo ago

Stupid Broken Pipe

how do I handle this without the thing just quitting, I've put try catches everywhere
No description
9 Replies
totally mixces
totally mixcesOP•9mo ago
I need this to not quit on these kinds of errors its annoying why is there no method to check if its writable at the time or whatever, ughhhh i'm also supossidely/most definitely losing data/packets somehow and I can't have that happening
ioB
ioB•9mo ago
can you share code
totally mixces
totally mixcesOP•9mo ago
Gimme a second (few mins) Not at pc rn Ugh
totally mixces
totally mixcesOP•9mo ago
No description
totally mixces
totally mixcesOP•9mo ago
async listen() {
this.server = new Server({
hostname: this.address,
port: this.port,
chunkSize: MAX_BYTES_ALLOWED
});

this.server.on("listen", () => Logger.log(Level.INFO, `Listening on ${this.address}:${this.port}`));

this.server.on("connect", (client: Client) => {
const connection = new ClientConnection(client);
this.connections.set(client, connection);
Logger.log(Level.INFO, `Client ${connection.id} connected!`);

client.addListener("receive", async (_, packet: Packet) => {
const reader = new ByteReader(packet.data);
reader.read(Type.VAR_INT) as number; // TODO: packet length?
const packet_id = reader.read(Type.VAR_INT) as number;
await connection.handle(this, reader, packet, packet_id);
});

client.addListener("close", async () => {
Logger.log(Level.INFO, `Client ${connection.id} disconnected!`);
// TODO: cleanup?
await connection.close();
this.connections.delete(client);
});
});

await this.server.listen();
}
async listen() {
this.server = new Server({
hostname: this.address,
port: this.port,
chunkSize: MAX_BYTES_ALLOWED
});

this.server.on("listen", () => Logger.log(Level.INFO, `Listening on ${this.address}:${this.port}`));

this.server.on("connect", (client: Client) => {
const connection = new ClientConnection(client);
this.connections.set(client, connection);
Logger.log(Level.INFO, `Client ${connection.id} connected!`);

client.addListener("receive", async (_, packet: Packet) => {
const reader = new ByteReader(packet.data);
reader.read(Type.VAR_INT) as number; // TODO: packet length?
const packet_id = reader.read(Type.VAR_INT) as number;
await connection.handle(this, reader, packet, packet_id);
});

client.addListener("close", async () => {
Logger.log(Level.INFO, `Client ${connection.id} disconnected!`);
// TODO: cleanup?
await connection.close();
this.connections.delete(client);
});
});

await this.server.listen();
}
Doctor 🤖
Doctor 🤖•9mo ago
Is this all the code?
totally mixces
totally mixcesOP•9mo ago
its enough to reproduce the error minus a few spots the issue is with this lib from "https://deno.land/x/tcp_socket@0.0.2/mods.ts"; @lino-levan .
marvinh.
marvinh.•9mo ago
@lowercasebtw Can you file an issue for this here https://github.com/denoland/deno/issues/new?template=bug_report.md ? The developers all hang out on GitHub and the best way to get bugs resolved is to post an issue over there.
totally mixces
totally mixcesOP•9mo ago
alright

Did you find this page helpful?