fix(socket): accept/socket 非 Windows 分支补齐 u64→INT 显式窄化(out_client.fd / return / out_sock.fd)
This commit is contained in:
1 parent
21154a3ab8
commit
bf6403c803
1 file changed
+3
-3
@@ -337,11 +337,11 @@ class Socket:
|
|||||||
client_fd: INT = INT(accept(self.fd, &addr, &addrlen))
|
client_fd: INT = INT(accept(self.fd, &addr, &addrlen))
|
||||||
if client_fd == SOCKET_ERROR:
|
if client_fd == SOCKET_ERROR:
|
||||||
return SOCKET_ERROR
|
return SOCKET_ERROR
|
||||||
out_client.fd = client_fd
|
out_client.fd = INT(client_fd)
|
||||||
out_client.family = self.family
|
out_client.family = self.family
|
||||||
out_client.type = self.type
|
out_client.type = self.type
|
||||||
out_client.protocol = self.protocol
|
out_client.protocol = self.protocol
|
||||||
return client_fd
|
return INT(client_fd)
|
||||||
|
|
||||||
def settimeout(self, timeout_ms: INT) -> INT:
|
def settimeout(self, timeout_ms: INT) -> INT:
|
||||||
"""Set timeout for receive and send operations (milliseconds).
|
"""Set timeout for receive and send operations (milliseconds).
|
||||||
@@ -408,7 +408,7 @@ def SocketCreate(family: INT, type: INT, protocol: INT, out_sock: Socket*) -> IN
|
|||||||
if fd == win32.winsock2.INVALID_SOCKET: return -1
|
if fd == win32.winsock2.INVALID_SOCKET: return -1
|
||||||
else:
|
else:
|
||||||
fd: INT = INT(socket(family, type, protocol))
|
fd: INT = INT(socket(family, type, protocol))
|
||||||
out_sock.fd = fd
|
out_sock.fd = INT(fd)
|
||||||
if fd == INVALID_SOCKET: return -1
|
if fd == INVALID_SOCKET: return -1
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user