Skip to content
This repository has been archived by the owner on Nov 6, 2023. It is now read-only.

Reformat and cleanup #19

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Ignore broken pipe error when writing
  • Loading branch information
frmdstryr committed Feb 15, 2022
commit 786aa99fe743925acec80b27e2b60c563c3da618
7 changes: 6 additions & 1 deletion src/app.zig
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,12 @@ pub const ServerConnection = struct {

// Request handler already sent the response
if (self.io.closed or response.finished) return;
try self.sendResponse(server_request);

// Send response, if the client drops, ignore it
self.sendResponse(server_request) catch |err| switch (err) {
error.BrokenPipe, error.ConnectionResetByPeer => return,
else => return err,
};

const keep_alive = self.canKeepAlive(request);
if (self.io.closed or !keep_alive) return;
Expand Down