This commit is contained in:
Jarred Sumner
2024-10-20 17:22:24 -07:00
parent ba66bf14da
commit 2c7ea40b65
2 changed files with 11 additions and 11 deletions

View File

@@ -1057,13 +1057,13 @@ pub const Listener = struct {
}
const vm = globalObject.bunVM();
const socket_config = SocketConfig.fromJS(vm, opts, globalObject, exception) orelse {
var socket_config: SocketConfig = SocketConfig.fromJS(vm, opts, globalObject, exception) orelse {
return .zero;
};
var hostname_or_unix = socket_config.hostname_or_unix;
const port = socket_config.port;
var ssl = socket_config.ssl;
var ssl = if (socket_config.ssl) |*ssl_config| ssl_config else null;
var handlers = socket_config.handlers;
var default_data = socket_config.default_data;
@@ -1178,8 +1178,8 @@ pub const Listener = struct {
}
}
const ctx_opts: uws.us_bun_socket_context_options_t = if (ssl != null)
JSC.API.ServerConfig.SSLConfig.asUSockets(&ssl.?)
const ctx_opts: uws.us_bun_socket_context_options_t = if (ssl) |ssl_config|
JSC.API.ServerConfig.SSLConfig.asUSockets(ssl_config)
else
.{};
@@ -3996,7 +3996,7 @@ pub const WindowsNamedPipeContext = if (Environment.isWindows) struct {
return this;
}
pub fn open(globalThis: *JSC.JSGlobalObject, fd: bun.FileDescriptor, ssl_config: ?JSC.API.ServerConfig.SSLConfig, socket: SocketType) !*uws.WindowsNamedPipe {
pub fn open(globalThis: *JSC.JSGlobalObject, fd: bun.FileDescriptor, ssl_config: ?*const JSC.API.ServerConfig.SSLConfig, socket: SocketType) !*uws.WindowsNamedPipe {
// TODO: reuse the same context for multiple connections when possibles
const this = WindowsNamedPipeContext.create(globalThis, socket);
@@ -4017,7 +4017,7 @@ pub const WindowsNamedPipeContext = if (Environment.isWindows) struct {
return &this.named_pipe;
}
pub fn connect(globalThis: *JSC.JSGlobalObject, path: []const u8, ssl_config: ?JSC.API.ServerConfig.SSLConfig, socket: SocketType) !*uws.WindowsNamedPipe {
pub fn connect(globalThis: *JSC.JSGlobalObject, path: []const u8, ssl_config: ?*const JSC.API.ServerConfig.SSLConfig, socket: SocketType) !*uws.WindowsNamedPipe {
// TODO: reuse the same context for multiple connections when possibles
const this = WindowsNamedPipeContext.create(globalThis, socket);

View File

@@ -857,11 +857,11 @@ pub const WindowsNamedPipe = if (Environment.isWindows) struct {
}
return .{ .result = {} };
}
pub fn open(this: *WindowsNamedPipe, fd: bun.FileDescriptor, ssl_options: ?JSC.API.ServerConfig.SSLConfig) JSC.Maybe(void) {
pub fn open(this: *WindowsNamedPipe, fd: bun.FileDescriptor, ssl_options: ?*const JSC.API.ServerConfig.SSLConfig) JSC.Maybe(void) {
bun.assert(this.pipe != null);
this.flags.disconnected = true;
if (ssl_options) |*tls| {
if (ssl_options) |tls| {
this.flags.is_ssl = true;
this.wrapper = WrapperType.init(tls, true, .{
.ctx = this,
@@ -893,13 +893,13 @@ pub const WindowsNamedPipe = if (Environment.isWindows) struct {
return .{ .result = {} };
}
pub fn connect(this: *WindowsNamedPipe, path: []const u8, ssl_options: ?JSC.API.ServerConfig.SSLConfig) JSC.Maybe(void) {
pub fn connect(this: *WindowsNamedPipe, path: []const u8, ssl_options: ?*const JSC.API.ServerConfig.SSLConfig) JSC.Maybe(void) {
bun.assert(this.pipe != null);
this.flags.disconnected = true;
// ref because we are connecting
_ = this.pipe.?.ref();
if (ssl_options) |*tls| {
if (ssl_options) |tls| {
this.flags.is_ssl = true;
this.wrapper = WrapperType.init(tls, true, .{
.ctx = this,
@@ -925,7 +925,7 @@ pub const WindowsNamedPipe = if (Environment.isWindows) struct {
this.connect_req.data = this;
return this.pipe.?.connect(&this.connect_req, path, this, onConnect);
}
pub fn startTLS(this: *WindowsNamedPipe, ssl_options: JSC.API.ServerConfig.SSLConfig, is_client: bool) !void {
pub fn startTLS(this: *WindowsNamedPipe, ssl_options: *const JSC.API.ServerConfig.SSLConfig, is_client: bool) !void {
this.flags.is_ssl = true;
if (this.start(is_client)) {
this.wrapper = try WrapperType.init(ssl_options, is_client, .{