Skip to content

Commit

Permalink
fix deinit on CallbackJobs
Browse files Browse the repository at this point in the history
  • Loading branch information
cirospaciari committed Jun 30, 2023
1 parent 691f881 commit 65e4a09
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/bun.js/api/bun.zig
Original file line number Diff line number Diff line change
Expand Up @@ -3794,6 +3794,8 @@ pub const Timer = struct {
result.then(globalThis, this, CallbackJob__onResolve, CallbackJob__onReject);
},
}
} else {
this.deinit();
}
}
};
Expand Down
7 changes: 5 additions & 2 deletions src/bun.js/api/bun/socket.zig
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ const Handlers = struct {
}

pub fn markInactive(this: *Handlers, ssl: bool, ctx: *uws.SocketContext, wrapped: WrappedType) void {
Listener.log("markInactive", .{});
Listener.log("markInactive {} {}", .{ wrapped, this.active_connections });
this.active_connections -= 1;
if (this.active_connections == 0) {
if (this.is_server) {
Expand Down Expand Up @@ -1106,7 +1106,10 @@ fn NewSocket(comptime ssl: bool) type {
this.handlers.markInactive(ssl, this.socket.context(), this.wrapped);
this.poll_ref.unref(vm);
this.has_pending_activity.store(false, .Release);
log("markInactive ok! {}", .{this.wrapped});
return;
}
log("markInactive not yet {}", .{this.wrapped});
}

pub fn onOpen(this: *This, socket: Socket) void {
Expand Down Expand Up @@ -1954,7 +1957,7 @@ fn NewSocket(comptime ssl: bool) type {
this.poll_ref.unref(vm);
this.has_pending_activity.store(false, .Release);
}

const array = JSC.JSValue.createEmptyArray(globalObject, 2);
array.putIndex(globalObject, 0, raw_js_value);
array.putIndex(globalObject, 1, tls_js_value);
Expand Down
4 changes: 4 additions & 0 deletions src/js/node/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ const Socket = (function (InternalSocket) {
this.#writeChunk = chunk;
}
}

prependoncelistener(){
console.log("hey!", arguments);
}
},
);

Expand Down
6 changes: 1 addition & 5 deletions test/js/third_party/nodemailer/nodemailer.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
import { test, expect, describe } from "bun:test";
import nodemailer from "nodemailer";
describe("nodemailer", () => {
// test hangs so we skip it until is investagated
test.skip("basic smtp", async () => {
test("basic smtp", async () => {
const account = await nodemailer.createTestAccount();
const transporter = nodemailer.createTransport({
host: account.smtp.host,
port: account.smtp.port,
secure: account.smtp.secure,
logger: true,
debugger: true,
auth: {
user: account.user, // generated ethereal user
pass: account.pass, // generated ethereal password
Expand All @@ -25,7 +22,6 @@ describe("nodemailer", () => {
html: "<b>Hello world?</b>", // html body
});
const url = nodemailer.getTestMessageUrl(info);

expect(url).toBeString();
transporter.close();
}, 10000);
Expand Down

0 comments on commit 65e4a09

Please sign in to comment.