lowercasebtw :3
lowercasebtw :3•3mo ago

Stupid Broken Pipe

how do I handle this without the thing just quitting, I've put try catches everywhere
No description
9 Replies
lowercasebtw :3
lowercasebtw :3OP•3mo 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•3mo ago
can you share code
lowercasebtw :3
lowercasebtw :3OP•2mo ago
Gimme a second (few mins) Not at pc rn Ugh
lowercasebtw :3
lowercasebtw :3OP•2mo ago
No description
lowercasebtw :3
lowercasebtw :3OP•2mo 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 🤖•2mo ago
Is this all the code?
lowercasebtw :3
lowercasebtw :3OP•2mo 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.•2mo 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.
lowercasebtw :3
lowercasebtw :3OP•2mo ago
alright