mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-12 17:17:09 -04:00
Fix multiplayer not working
This commit is contained in:
parent
3e828d09af
commit
355f35c719
@ -283,7 +283,9 @@ cc_result Socket_GetError(cc_socket s, cc_result* result) {
|
||||
cc_result Socket_Connect(cc_socket s, const cc_string* ip, int port) {
|
||||
char addr[NATIVE_STR_LEN];
|
||||
Platform_EncodeUtf8(addr, ip);
|
||||
return interop_SocketConnect(s, addr, port);
|
||||
|
||||
/* returned result is negative for error */
|
||||
return -interop_SocketConnect(s, addr, port);
|
||||
}
|
||||
|
||||
cc_result Socket_Read(cc_socket s, cc_uint8* data, cc_uint32 count, cc_uint32* modified) {
|
||||
|
@ -203,17 +203,13 @@ mergeInto(LibraryManager.library, {
|
||||
getPending:function(fd) {
|
||||
var sock = this.sockets[fd];
|
||||
if (!sock) return this.EBADF;
|
||||
|
||||
var bytes = 0;
|
||||
if (sock.recv_queue.length) {
|
||||
bytes = sock.recv_queue[0].data.length;
|
||||
}
|
||||
return bytes;
|
||||
|
||||
return sock.recv_queue.length;
|
||||
},
|
||||
getError:function(fd) {
|
||||
var sock = this.sockets[fd];
|
||||
if (!sock) return this.EBADF;
|
||||
|
||||
|
||||
return sock.error || 0;
|
||||
},
|
||||
close:function(fd) {
|
||||
@ -277,8 +273,8 @@ mergeInto(LibraryManager.library, {
|
||||
sock.recv_queue.unshift(packet);
|
||||
}
|
||||
|
||||
HEAPU8.set(msg.buffer, dst);
|
||||
return msg.buffer.byteLength;
|
||||
HEAPU8.set(msg, dst);
|
||||
return msg.byteLength;
|
||||
}
|
||||
};
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user