| author | |
| committer | |
| log | 0e67568bcac0c4aea795969e2c8b733326b87bec |
| tree | e18f13a10540666d7d51d5e0de7208265ab2ad83 |
| parent | 4a4d2c0d80443a00945beeff4e3acaa9e7ea59cb |
| signature | Commit is signed but in an unrecognized format. |
- os: fix typos on setsockopt2 files changed, 5 insertions(+), 5 deletions(-)
lib/std/net.zig+3-1| ... | ... | @@ -1279,6 +1279,7 @@ fn dnsParseCallback(ctx: dpc_ctx, rr: u8, data: []const u8, packet: []const u8) |
| 1279 | 1279 | pub const StreamServer = struct { |
| 1280 | 1280 | /// Copied from `Options` on `init`. |
| 1281 | 1281 | kernel_backlog: u32, |
| 1282 | reuse_address: bool, | |
| 1282 | 1283 | |
| 1283 | 1284 | /// `undefined` until `listen` returns successfully. |
| 1284 | 1285 | listen_address: Address, |
| ... | ... | @@ -1301,6 +1302,7 @@ pub const StreamServer = struct { |
| 1301 | 1302 | return StreamServer{ |
| 1302 | 1303 | .sockfd = null, |
| 1303 | 1304 | .kernel_backlog = options.kernel_backlog, |
| 1305 | .reuse_address = options.reuse_address, | |
| 1304 | 1306 | .listen_address = undefined, |
| 1305 | 1307 | }; |
| 1306 | 1308 | } |
| ... | ... | @@ -1323,7 +1325,7 @@ pub const StreamServer = struct { |
| 1323 | 1325 | self.sockfd = null; |
| 1324 | 1326 | } |
| 1325 | 1327 | |
| 1326 | if (self.options.reuse_address) { | |
| 1328 | if (self.reuse_address) { | |
| 1327 | 1329 | var optval: c_int = 1; |
| 1328 | 1330 | try os.setsockopt( |
| 1329 | 1331 | self.sockfd.?, |
lib/std/os.zig+2-4| ... | ... | @@ -3252,16 +3252,14 @@ pub fn sched_yield() SchedYieldError!void { |
| 3252 | 3252 | } |
| 3253 | 3253 | |
| 3254 | 3254 | /// Set a socket's options. |
| 3255 | pub fn setsockopt(fd: fd_t, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) SetSockOptError!void { | |
| 3256 | const rc = system.setsockopt(); | |
| 3257 | ||
| 3255 | pub fn setsockopt(fd: fd_t, level: u32, optname: u32, optval: [*]const u8, optlen: socklen_t) !void { | |
| 3258 | 3256 | switch (errno(system.setsockopt(fd, level, optname, optval, optlen))) { |
| 3259 | 3257 | 0 => {}, |
| 3260 | 3258 | EBADF => unreachable, |
| 3261 | 3259 | EINVAL => unreachable, |
| 3262 | 3260 | EDOM => return error.TimeoutTooBig, |
| 3263 | 3261 | EISCONN => return error.AlreadyConnected, |
| 3264 | ENOPROTOOOPT => return error.InvalidProtocolOption, | |
| 3262 | ENOPROTOOPT => return error.InvalidProtocolOption, | |
| 3265 | 3263 | ENOTSOCK => return error.NotSocket, |
| 3266 | 3264 | |
| 3267 | 3265 | ENOMEM => return error.OutOfMemory, |