Skip to content

Commit

Permalink
opsie
Browse files Browse the repository at this point in the history
  • Loading branch information
cirospaciari committed Oct 17, 2024
1 parent e02379e commit 57f18d8
Showing 1 changed file with 26 additions and 25 deletions.
51 changes: 26 additions & 25 deletions src/bun.js/api/bun/h2_frame_parser.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3757,31 +3757,7 @@ pub const H2FrameParser = struct {
globalObject.throwInvalidArguments("expected options as argument", .{});
return null;
}
const socket_js = args_list.ptr[0];

if (!socket_js.isEmptyOrUndefinedOrNull()) {
// check if socket is provided, and if it is a valid native socket
if (JSTLSSocket.fromJS(socket_js)) |socket| {
log("TLSSocket attached", .{});
if (socket.attachNativeCallback(.{ .h2 = this })) {
this.native_socket = .{ .tls = socket };
} else {
socket.ref();

this.native_socket = .{ .tls_writeonly = socket };
}
} else if (JSTCPSocket.fromJS(socket_js)) |socket| {
log("TCPSocket attached", .{});
if (socket.attachNativeCallback(.{ .h2 = this })) {
this.native_socket = .{ .tcp = socket };
} else {
socket.ref();

this.native_socket = .{ .tcp_writeonly = socket };
}
}
}



var exception: JSC.C.JSValueRef = null;
const context_obj = options.get(globalObject, "context") orelse {
Expand Down Expand Up @@ -3835,6 +3811,31 @@ pub const H2FrameParser = struct {
});
}
};
const socket_js = args_list.ptr[1];

if (!socket_js.isEmptyOrUndefinedOrNull()) {
// check if socket is provided, and if it is a valid native socket
if (JSTLSSocket.fromJS(socket_js)) |socket| {
log("TLSSocket attached", .{});
if (socket.attachNativeCallback(.{ .h2 = this })) {
this.native_socket = .{ .tls = socket };
} else {
socket.ref();

this.native_socket = .{ .tls_writeonly = socket };
}
} else if (JSTCPSocket.fromJS(socket_js)) |socket| {
log("TCPSocket attached", .{});
if (socket.attachNativeCallback(.{ .h2 = this })) {
this.native_socket = .{ .tcp = socket };
} else {
socket.ref();

this.native_socket = .{ .tcp_writeonly = socket };
}
}
}


if (options.get(globalObject, "settings")) |settings_js| {
if (!settings_js.isEmptyOrUndefinedOrNull()) {
Expand Down

0 comments on commit 57f18d8

Please sign in to comment.