Compare commits

...

2 Commits

Author SHA1 Message Date
Jarred Sumner
57cf244dd7 Fix usage of getTruthy 2024-11-27 00:09:48 -08:00
Jarred Sumner
b1912555a6 Update socket.zig 2024-11-26 23:43:18 -08:00

View File

@@ -365,11 +365,11 @@ pub const SocketConfig = struct {
}
}
if (try opts.getTruthy(globalObject, "exclusive")) |_| {
exclusive = true;
if (try opts.getBooleanLoose(globalObject, "exclusive")) |exclusive_| {
exclusive = exclusive_;
}
if (try opts.getTruthy(globalObject, "allowHalfOpen")) |_| {
allowHalfOpen = true;
if (try opts.getBooleanLoose(globalObject, "allowHalfOpen")) |allow_half_open| {
allowHalfOpen = allow_half_open;
}
if (try opts.getStringish(globalObject, "hostname") orelse try opts.getStringish(globalObject, "host")) |hostname| {
@@ -2174,6 +2174,8 @@ fn NewSocket(comptime ssl: bool) type {
}
const args = callframe.argumentsUndef(2);
this.ref();
defer this.deref();
return switch (this.writeOrEndBuffered(globalObject, args.ptr[0], args.ptr[1], false)) {
.fail => .zero,
@@ -2494,6 +2496,9 @@ fn NewSocket(comptime ssl: bool) type {
return JSValue.jsNumber(@as(i32, -1));
}
this.ref();
defer this.deref();
return switch (this.writeOrEnd(globalObject, args.mut(), false, true)) {
.fail => .zero,
.success => |result| brk: {