Fix unreachable

This commit is contained in:
Jarred Sumner
2022-09-28 23:38:54 -07:00
parent 9438540bf9
commit e69e8d35b9

View File

@@ -7,7 +7,7 @@ const ZigURL = @import("../../url.zig").URL;
const HTTPClient = @import("http");
const NetworkThread = HTTPClient.NetworkThread;
const AsyncIO = NetworkThread.AsyncIO;
const JSC = @import("root").JSC;
const JSC = @import("javascript_core");
const js = JSC.C;
const Method = @import("../../http/method.zig").Method;
@@ -1118,9 +1118,12 @@ pub const FileSink = struct {
}
fn cleanup(this: *FileSink) void {
this.unwatch(this.fd);
if (this.fd != std.math.maxInt(JSC.Node.FileDescriptor)) {
if (this.scheduled_count > 0) {
this.scheduled_count = 0;
this.unwatch(this.fd);
}
_ = JSC.Node.Syscall.close(this.fd);
this.fd = std.math.maxInt(JSC.Node.FileDescriptor);
}