fix(socket): socket/accept 的 u64 handle 在 INT 目标处补显式窄化(与 213/328 对称,修隐式窄化报错)
This commit is contained in:
1 parent
4aa8d399ff
commit
21154a3ab8
1 file changed
+3
-3
@@ -212,7 +212,7 @@ class Socket:
|
||||
if platmacro.IS_WINDOWS:
|
||||
self.fd = INT(win32.winsock2.socket(family, type, protocol))
|
||||
else:
|
||||
self.fd = socket(family, type, protocol)
|
||||
self.fd = INT(socket(family, type, protocol))
|
||||
|
||||
def connect(self, host: str, port: INT) -> INT:
|
||||
"""Connect to remote host.
|
||||
@@ -334,7 +334,7 @@ class Socket:
|
||||
out_client.protocol = self.protocol
|
||||
return INT(client_fd)
|
||||
|
||||
client_fd: INT = accept(self.fd, &addr, &addrlen)
|
||||
client_fd: INT = INT(accept(self.fd, &addr, &addrlen))
|
||||
if client_fd == SOCKET_ERROR:
|
||||
return SOCKET_ERROR
|
||||
out_client.fd = client_fd
|
||||
@@ -407,7 +407,7 @@ def SocketCreate(family: INT, type: INT, protocol: INT, out_sock: Socket*) -> IN
|
||||
out_sock.fd = INT(fd)
|
||||
if fd == win32.winsock2.INVALID_SOCKET: return -1
|
||||
else:
|
||||
fd: INT = socket(family, type, protocol)
|
||||
fd: INT = INT(socket(family, type, protocol))
|
||||
out_sock.fd = fd
|
||||
if fd == INVALID_SOCKET: return -1
|
||||
return 0
|
||||
|
||||
Reference in new issue
Block a user