mirror of
https://github.com/oven-sh/bun
synced 2026-02-12 11:59:00 +00:00
Split uSockets/uWS <> Zig bindings into many different files (#20138)
Co-authored-by: Jarred-Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
@@ -1431,7 +1431,7 @@ pub const PostgresSQLConnection = struct {
|
||||
|
||||
pub fn setupTLS(this: *PostgresSQLConnection) void {
|
||||
debug("setupTLS", .{});
|
||||
const new_socket = uws.us_socket_upgrade_to_tls(this.socket.SocketTCP.socket.connected, this.tls_ctx.?, this.tls_config.server_name) orelse {
|
||||
const new_socket = this.socket.SocketTCP.socket.connected.upgrade(this.tls_ctx.?, this.tls_config.server_name) orelse {
|
||||
this.fail("Failed to upgrade to TLS", error.TLSUpgradeFailed);
|
||||
return;
|
||||
};
|
||||
@@ -1843,7 +1843,7 @@ pub const PostgresSQLConnection = struct {
|
||||
// We create it right here so we can throw errors early.
|
||||
const context_options = tls_config.asUSockets();
|
||||
var err: uws.create_bun_socket_error_t = .none;
|
||||
tls_ctx = uws.us_create_bun_ssl_socket_context(vm.uwsLoop(), @sizeOf(*PostgresSQLConnection), context_options, &err) orelse {
|
||||
tls_ctx = uws.SocketContext.createSSLContext(vm.uwsLoop(), @sizeOf(*PostgresSQLConnection), context_options, &err) orelse {
|
||||
if (err != .none) {
|
||||
return globalObject.throw("failed to create TLS context", .{});
|
||||
} else {
|
||||
@@ -1951,7 +1951,7 @@ pub const PostgresSQLConnection = struct {
|
||||
defer hostname.deinit();
|
||||
|
||||
const ctx = vm.rareData().postgresql_context.tcp orelse brk: {
|
||||
const ctx_ = uws.us_create_bun_nossl_socket_context(vm.uwsLoop(), @sizeOf(*PostgresSQLConnection)).?;
|
||||
const ctx_ = uws.SocketContext.createNoSSLContext(vm.uwsLoop(), @sizeOf(*PostgresSQLConnection)).?;
|
||||
uws.NewSocketHandler(false).configure(ctx_, true, *PostgresSQLConnection, SocketHandler(false));
|
||||
vm.rareData().postgresql_context.tcp = ctx_;
|
||||
break :brk ctx_;
|
||||
|
||||
Reference in New Issue
Block a user