mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
fix Socket.get_option calling setsockopt instead of getsockopt (#2421)
* fix Socket.get_option * `Socket.get_option` didn't properly call `getsockopt`, and `getsockopt` had an invalid signature. --------- Co-authored-by: Christoffer Lerno <christoffer@aegik.com>
This commit is contained in:
@@ -116,7 +116,8 @@ fn void? Socket.set_option(&self, SocketOption option, bool value)
|
||||
fn bool? Socket.get_option(&self, SocketOption option)
|
||||
{
|
||||
CInt flag;
|
||||
int errcode = os::setsockopt(self.sock, os::SOL_SOCKET, option.value, &flag, CInt.sizeof);
|
||||
Socklen_t socklen = CInt.sizeof;
|
||||
int errcode = os::getsockopt(self.sock, os::SOL_SOCKET, option.value, &flag, &socklen);
|
||||
if (errcode != 0) return SOCKOPT_FAILED?;
|
||||
return (bool)flag;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user