mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
Migrate server.accept() to use argumentsAsArray
Replaced .arguments_old() with .argumentsAsArray() to comply with codebase ban on .arguments_old(). - Simplified argument handling by using argumentsAsArray(1)[0] - Removed manual length check (argumentsAsArray handles this) - Clarified SSL documentation wording slightly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1818,13 +1818,8 @@ pub fn NewServer(protocol_enum: enum { http, https }, development_kind: enum { d
|
||||
}
|
||||
|
||||
pub fn doAccept(this: *ThisServer, globalThis: *jsc.JSGlobalObject, callframe: *jsc.CallFrame) bun.JSError!jsc.JSValue {
|
||||
const arguments = callframe.arguments_old(1);
|
||||
const fd_value = callframe.argumentsAsArray(1)[0];
|
||||
|
||||
if (arguments.len < 1) {
|
||||
return globalThis.throwNotEnoughArguments("accept", 1, arguments.len);
|
||||
}
|
||||
|
||||
const fd_value = arguments.ptr[0];
|
||||
if (!fd_value.isNumber()) {
|
||||
return globalThis.throwInvalidArguments("accept expects a file descriptor number", .{});
|
||||
}
|
||||
|
||||
@@ -369,7 +369,7 @@ pub fn NewApp(comptime ssl: bool) type {
|
||||
/// and will close it when the connection terminates. On failure (return value -1),
|
||||
/// the caller retains ownership and must close the file descriptor.
|
||||
///
|
||||
/// Supports both SSL/TLS and non-SSL sockets.
|
||||
/// Supports both SSL/TLS and non-SSL sockets based on the server's SSL configuration.
|
||||
///
|
||||
/// Returns 0 on success, -1 on failure.
|
||||
pub fn accept(app: *ThisApp, fd: bun.FileDescriptor) i32 {
|
||||
|
||||
Reference in New Issue
Block a user