This commit is contained in:
Ciro Spaciari
2025-05-29 21:06:16 -07:00
parent 1c48c251a2
commit ec9e318c6f

View File

@@ -4230,6 +4230,7 @@ pub const H2FrameParser = struct {
this.detachNativeSocket();
if (JSTLSSocket.fromJS(socket_js)) |socket| {
log("TLSSocket attached", .{});
defer _ = this.flush();
if (socket.attachNativeCallback(.{ .h2 = this })) {
this.native_socket = .{ .tls = socket };
} else {
@@ -4241,6 +4242,7 @@ pub const H2FrameParser = struct {
this.has_nonnative_backpressure = false;
} else if (JSTCPSocket.fromJS(socket_js)) |socket| {
log("TCPSocket attached", .{});
defer _ = this.flush();
if (socket.attachNativeCallback(.{ .h2 = this })) {
this.native_socket = .{ .tcp = socket };
@@ -4261,9 +4263,11 @@ pub const H2FrameParser = struct {
switch (native_socket) {
inline .tcp, .tls => |socket| {
socket.poll_ref.unref(this.globalThis.bunVM());
socket.detachNativeCallback();
},
inline .tcp_writeonly, .tls_writeonly => |socket| {
socket.poll_ref.unref(this.globalThis.bunVM());
socket.deref();
},
.none => {},
@@ -4337,6 +4341,7 @@ pub const H2FrameParser = struct {
if (try options.get(globalObject, "native")) |socket_js| {
if (JSTLSSocket.fromJS(socket_js)) |socket| {
log("TLSSocket attached", .{});
defer _ = this.flush();
if (socket.attachNativeCallback(.{ .h2 = this })) {
this.native_socket = .{ .tls = socket };
} else {
@@ -4346,6 +4351,7 @@ pub const H2FrameParser = struct {
}
} else if (JSTCPSocket.fromJS(socket_js)) |socket| {
log("TCPSocket attached", .{});
defer _ = this.flush();
if (socket.attachNativeCallback(.{ .h2 = this })) {
this.native_socket = .{ .tcp = socket };
} else {