mirror of
https://github.com/godotengine/godot.git
synced 2025-03-19 23:53:32 +08:00
Merge pull request #14708 from Faless/get_packet_not_const_rebased
Remove "const" from PacketPeer get_packet/get_var, move windows network related stuff to drivers
This commit is contained in:
commit
cf7bd1a7e3
@ -49,7 +49,7 @@ bool PacketPeer::is_object_decoding_allowed() const {
|
||||
return allow_object_decoding;
|
||||
}
|
||||
|
||||
Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) const {
|
||||
Error PacketPeer::get_packet_buffer(PoolVector<uint8_t> &r_buffer) {
|
||||
|
||||
const uint8_t *buffer;
|
||||
int buffer_size;
|
||||
@ -78,7 +78,7 @@ Error PacketPeer::put_packet_buffer(const PoolVector<uint8_t> &p_buffer) {
|
||||
return put_packet(&r[0], len);
|
||||
}
|
||||
|
||||
Error PacketPeer::get_var(Variant &r_variant) const {
|
||||
Error PacketPeer::get_var(Variant &r_variant) {
|
||||
|
||||
const uint8_t *buffer;
|
||||
int buffer_size;
|
||||
@ -107,7 +107,7 @@ Error PacketPeer::put_var(const Variant &p_packet) {
|
||||
return put_packet(buf, len);
|
||||
}
|
||||
|
||||
Variant PacketPeer::_bnd_get_var() const {
|
||||
Variant PacketPeer::_bnd_get_var() {
|
||||
Variant var;
|
||||
get_var(var);
|
||||
|
||||
@ -117,7 +117,7 @@ Variant PacketPeer::_bnd_get_var() const {
|
||||
Error PacketPeer::_put_packet(const PoolVector<uint8_t> &p_buffer) {
|
||||
return put_packet_buffer(p_buffer);
|
||||
}
|
||||
PoolVector<uint8_t> PacketPeer::_get_packet() const {
|
||||
PoolVector<uint8_t> PacketPeer::_get_packet() {
|
||||
|
||||
PoolVector<uint8_t> raw;
|
||||
last_get_error = get_packet_buffer(raw);
|
||||
@ -202,7 +202,7 @@ int PacketPeerStream::get_available_packet_count() const {
|
||||
return count;
|
||||
}
|
||||
|
||||
Error PacketPeerStream::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
|
||||
Error PacketPeerStream::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
|
||||
|
||||
ERR_FAIL_COND_V(peer.is_null(), ERR_UNCONFIGURED);
|
||||
_poll_buffer();
|
||||
|
@ -37,13 +37,13 @@ class PacketPeer : public Reference {
|
||||
|
||||
GDCLASS(PacketPeer, Reference);
|
||||
|
||||
Variant _bnd_get_var() const;
|
||||
Variant _bnd_get_var();
|
||||
void _bnd_put_var(const Variant &p_var);
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
Error _put_packet(const PoolVector<uint8_t> &p_buffer);
|
||||
PoolVector<uint8_t> _get_packet() const;
|
||||
PoolVector<uint8_t> _get_packet();
|
||||
Error _get_packet_error() const;
|
||||
|
||||
mutable Error last_get_error;
|
||||
@ -52,17 +52,17 @@ class PacketPeer : public Reference {
|
||||
|
||||
public:
|
||||
virtual int get_available_packet_count() const = 0;
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const = 0; ///< buffer is GONE after next get_packet
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) = 0; ///< buffer is GONE after next get_packet
|
||||
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size) = 0;
|
||||
|
||||
virtual int get_max_packet_size() const = 0;
|
||||
|
||||
/* helpers / binders */
|
||||
|
||||
virtual Error get_packet_buffer(PoolVector<uint8_t> &r_buffer) const;
|
||||
virtual Error get_packet_buffer(PoolVector<uint8_t> &r_buffer);
|
||||
virtual Error put_packet_buffer(const PoolVector<uint8_t> &p_buffer);
|
||||
|
||||
virtual Error get_var(Variant &r_variant) const;
|
||||
virtual Error get_var(Variant &r_variant);
|
||||
virtual Error put_var(const Variant &p_packet);
|
||||
|
||||
void set_allow_object_decoding(bool p_enable);
|
||||
@ -91,7 +91,7 @@ protected:
|
||||
|
||||
public:
|
||||
virtual int get_available_packet_count() const;
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const;
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
|
||||
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
|
||||
|
||||
virtual int get_max_packet_size() const;
|
||||
|
@ -65,7 +65,7 @@ int PacketPeerUDPPosix::get_available_packet_count() const {
|
||||
return queue_count;
|
||||
}
|
||||
|
||||
Error PacketPeerUDPPosix::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
|
||||
Error PacketPeerUDPPosix::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
|
||||
|
||||
Error err = const_cast<PacketPeerUDPPosix *>(this)->_poll(false);
|
||||
if (err != OK)
|
||||
|
@ -41,12 +41,12 @@ class PacketPeerUDPPosix : public PacketPeerUDP {
|
||||
PACKET_BUFFER_SIZE = 65536
|
||||
};
|
||||
|
||||
mutable RingBuffer<uint8_t> rb;
|
||||
RingBuffer<uint8_t> rb;
|
||||
uint8_t recv_buffer[PACKET_BUFFER_SIZE];
|
||||
mutable uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
||||
mutable IP_Address packet_ip;
|
||||
mutable int packet_port;
|
||||
mutable int queue_count;
|
||||
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
||||
IP_Address packet_ip;
|
||||
int packet_port;
|
||||
int queue_count;
|
||||
int sockfd;
|
||||
bool sock_blocking;
|
||||
IP::Type sock_type;
|
||||
@ -62,7 +62,7 @@ class PacketPeerUDPPosix : public PacketPeerUDP {
|
||||
|
||||
public:
|
||||
virtual int get_available_packet_count() const;
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const;
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
|
||||
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
|
||||
|
||||
virtual int get_max_packet_size() const;
|
||||
|
@ -27,6 +27,8 @@
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
||||
#include "packet_peer_udp_winsock.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
@ -43,7 +45,7 @@ int PacketPeerUDPWinsock::get_available_packet_count() const {
|
||||
return queue_count;
|
||||
}
|
||||
|
||||
Error PacketPeerUDPWinsock::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
|
||||
Error PacketPeerUDPWinsock::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
|
||||
|
||||
Error err = const_cast<PacketPeerUDPWinsock *>(this)->_poll(false);
|
||||
if (err != OK)
|
||||
@ -291,3 +293,5 @@ PacketPeerUDPWinsock::~PacketPeerUDPWinsock() {
|
||||
|
||||
close();
|
||||
}
|
||||
|
||||
#endif
|
@ -27,6 +27,8 @@
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
||||
#ifndef PACKET_PEER_UDP_WINSOCK_H
|
||||
#define PACKET_PEER_UDP_WINSOCK_H
|
||||
|
||||
@ -39,12 +41,12 @@ class PacketPeerUDPWinsock : public PacketPeerUDP {
|
||||
PACKET_BUFFER_SIZE = 65536
|
||||
};
|
||||
|
||||
mutable RingBuffer<uint8_t> rb;
|
||||
RingBuffer<uint8_t> rb;
|
||||
uint8_t recv_buffer[PACKET_BUFFER_SIZE];
|
||||
mutable uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
||||
mutable IP_Address packet_ip;
|
||||
mutable int packet_port;
|
||||
mutable int queue_count;
|
||||
uint8_t packet_buffer[PACKET_BUFFER_SIZE];
|
||||
IP_Address packet_ip;
|
||||
int packet_port;
|
||||
int queue_count;
|
||||
int sockfd;
|
||||
bool sock_blocking;
|
||||
IP::Type sock_type;
|
||||
@ -62,7 +64,7 @@ class PacketPeerUDPWinsock : public PacketPeerUDP {
|
||||
|
||||
public:
|
||||
virtual int get_available_packet_count() const;
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const;
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size);
|
||||
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
|
||||
|
||||
virtual int get_max_packet_size() const;
|
||||
@ -82,3 +84,5 @@ public:
|
||||
~PacketPeerUDPWinsock();
|
||||
};
|
||||
#endif // PACKET_PEER_UDP_WINSOCK_H
|
||||
|
||||
#endif
|
@ -1,5 +1,5 @@
|
||||
/*************************************************************************/
|
||||
/* stream_peer_winsock.cpp */
|
||||
/* stream_peer_tcp_winsock.cpp */
|
||||
/*************************************************************************/
|
||||
/* This file is part of: */
|
||||
/* GODOT ENGINE */
|
||||
@ -29,7 +29,7 @@
|
||||
/*************************************************************************/
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
||||
#include "stream_peer_winsock.h"
|
||||
#include "stream_peer_tcp_winsock.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
@ -38,14 +38,14 @@
|
||||
|
||||
int winsock_refcount = 0;
|
||||
|
||||
StreamPeerTCP *StreamPeerWinsock::_create() {
|
||||
StreamPeerTCP *StreamPeerTCPWinsock::_create() {
|
||||
|
||||
return memnew(StreamPeerWinsock);
|
||||
return memnew(StreamPeerTCPWinsock);
|
||||
};
|
||||
|
||||
void StreamPeerWinsock::make_default() {
|
||||
void StreamPeerTCPWinsock::make_default() {
|
||||
|
||||
StreamPeerTCP::_create = StreamPeerWinsock::_create;
|
||||
StreamPeerTCP::_create = StreamPeerTCPWinsock::_create;
|
||||
|
||||
if (winsock_refcount == 0) {
|
||||
WSADATA data;
|
||||
@ -54,7 +54,7 @@ void StreamPeerWinsock::make_default() {
|
||||
++winsock_refcount;
|
||||
};
|
||||
|
||||
void StreamPeerWinsock::cleanup() {
|
||||
void StreamPeerTCPWinsock::cleanup() {
|
||||
|
||||
--winsock_refcount;
|
||||
if (winsock_refcount == 0) {
|
||||
@ -63,7 +63,7 @@ void StreamPeerWinsock::cleanup() {
|
||||
};
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::_block(int p_sockfd, bool p_read, bool p_write) const {
|
||||
Error StreamPeerTCPWinsock::_block(int p_sockfd, bool p_read, bool p_write) const {
|
||||
|
||||
fd_set read, write;
|
||||
FD_ZERO(&read);
|
||||
@ -78,7 +78,7 @@ Error StreamPeerWinsock::_block(int p_sockfd, bool p_read, bool p_write) const {
|
||||
return ret < 0 ? FAILED : OK;
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::_poll_connection() const {
|
||||
Error StreamPeerTCPWinsock::_poll_connection() const {
|
||||
|
||||
ERR_FAIL_COND_V(status != STATUS_CONNECTING || sockfd == INVALID_SOCKET, FAILED);
|
||||
|
||||
@ -108,7 +108,7 @@ Error StreamPeerWinsock::_poll_connection() const {
|
||||
return OK;
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
|
||||
Error StreamPeerTCPWinsock::write(const uint8_t *p_data, int p_bytes, int &r_sent, bool p_block) {
|
||||
|
||||
if (status == STATUS_NONE || status == STATUS_ERROR) {
|
||||
|
||||
@ -166,7 +166,7 @@ Error StreamPeerWinsock::write(const uint8_t *p_data, int p_bytes, int &r_sent,
|
||||
return OK;
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
|
||||
Error StreamPeerTCPWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received, bool p_block) {
|
||||
|
||||
if (!is_connected_to_host()) {
|
||||
|
||||
@ -224,29 +224,29 @@ Error StreamPeerWinsock::read(uint8_t *p_buffer, int p_bytes, int &r_received, b
|
||||
return OK;
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::put_data(const uint8_t *p_data, int p_bytes) {
|
||||
Error StreamPeerTCPWinsock::put_data(const uint8_t *p_data, int p_bytes) {
|
||||
|
||||
int total;
|
||||
return write(p_data, p_bytes, total, true);
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
|
||||
Error StreamPeerTCPWinsock::put_partial_data(const uint8_t *p_data, int p_bytes, int &r_sent) {
|
||||
|
||||
return write(p_data, p_bytes, r_sent, false);
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::get_data(uint8_t *p_buffer, int p_bytes) {
|
||||
Error StreamPeerTCPWinsock::get_data(uint8_t *p_buffer, int p_bytes) {
|
||||
|
||||
int total;
|
||||
return read(p_buffer, p_bytes, total, true);
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
|
||||
Error StreamPeerTCPWinsock::get_partial_data(uint8_t *p_buffer, int p_bytes, int &r_received) {
|
||||
|
||||
return read(p_buffer, p_bytes, r_received, false);
|
||||
};
|
||||
|
||||
StreamPeerTCP::Status StreamPeerWinsock::get_status() const {
|
||||
StreamPeerTCP::Status StreamPeerTCPWinsock::get_status() const {
|
||||
|
||||
if (status == STATUS_CONNECTING) {
|
||||
_poll_connection();
|
||||
@ -255,7 +255,7 @@ StreamPeerTCP::Status StreamPeerWinsock::get_status() const {
|
||||
return status;
|
||||
};
|
||||
|
||||
bool StreamPeerWinsock::is_connected_to_host() const {
|
||||
bool StreamPeerTCPWinsock::is_connected_to_host() const {
|
||||
|
||||
if (status == STATUS_NONE || status == STATUS_ERROR) {
|
||||
|
||||
@ -268,7 +268,7 @@ bool StreamPeerWinsock::is_connected_to_host() const {
|
||||
return (sockfd != INVALID_SOCKET);
|
||||
};
|
||||
|
||||
void StreamPeerWinsock::disconnect_from_host() {
|
||||
void StreamPeerTCPWinsock::disconnect_from_host() {
|
||||
|
||||
if (sockfd != INVALID_SOCKET)
|
||||
closesocket(sockfd);
|
||||
@ -281,7 +281,7 @@ void StreamPeerWinsock::disconnect_from_host() {
|
||||
peer_port = 0;
|
||||
};
|
||||
|
||||
void StreamPeerWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type) {
|
||||
void StreamPeerTCPWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type) {
|
||||
|
||||
sockfd = p_sockfd;
|
||||
sock_type = p_sock_type;
|
||||
@ -290,7 +290,7 @@ void StreamPeerWinsock::set_socket(int p_sockfd, IP_Address p_host, int p_port,
|
||||
peer_port = p_port;
|
||||
};
|
||||
|
||||
Error StreamPeerWinsock::connect_to_host(const IP_Address &p_host, uint16_t p_port) {
|
||||
Error StreamPeerTCPWinsock::connect_to_host(const IP_Address &p_host, uint16_t p_port) {
|
||||
|
||||
ERR_FAIL_COND_V(!p_host.is_valid(), ERR_INVALID_PARAMETER);
|
||||
|
||||
@ -331,13 +331,13 @@ Error StreamPeerWinsock::connect_to_host(const IP_Address &p_host, uint16_t p_po
|
||||
return OK;
|
||||
};
|
||||
|
||||
void StreamPeerWinsock::set_nodelay(bool p_enabled) {
|
||||
void StreamPeerTCPWinsock::set_nodelay(bool p_enabled) {
|
||||
ERR_FAIL_COND(!is_connected_to_host());
|
||||
int flag = p_enabled ? 1 : 0;
|
||||
setsockopt(sockfd, IPPROTO_TCP, TCP_NODELAY, (char *)&flag, sizeof(int));
|
||||
}
|
||||
|
||||
int StreamPeerWinsock::get_available_bytes() const {
|
||||
int StreamPeerTCPWinsock::get_available_bytes() const {
|
||||
|
||||
unsigned long len;
|
||||
int ret = ioctlsocket(sockfd, FIONREAD, &len);
|
||||
@ -345,17 +345,17 @@ int StreamPeerWinsock::get_available_bytes() const {
|
||||
return len;
|
||||
}
|
||||
|
||||
IP_Address StreamPeerWinsock::get_connected_host() const {
|
||||
IP_Address StreamPeerTCPWinsock::get_connected_host() const {
|
||||
|
||||
return peer_host;
|
||||
};
|
||||
|
||||
uint16_t StreamPeerWinsock::get_connected_port() const {
|
||||
uint16_t StreamPeerTCPWinsock::get_connected_port() const {
|
||||
|
||||
return peer_port;
|
||||
};
|
||||
|
||||
StreamPeerWinsock::StreamPeerWinsock() {
|
||||
StreamPeerTCPWinsock::StreamPeerTCPWinsock() {
|
||||
|
||||
sock_type = IP::TYPE_NONE;
|
||||
sockfd = INVALID_SOCKET;
|
||||
@ -363,7 +363,7 @@ StreamPeerWinsock::StreamPeerWinsock() {
|
||||
peer_port = 0;
|
||||
};
|
||||
|
||||
StreamPeerWinsock::~StreamPeerWinsock() {
|
||||
StreamPeerTCPWinsock::~StreamPeerTCPWinsock() {
|
||||
|
||||
disconnect_from_host();
|
||||
};
|
@ -29,15 +29,15 @@
|
||||
/*************************************************************************/
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
||||
#ifndef STREAM_PEER_WINSOCK_H
|
||||
#define STREAM_PEER_WINSOCK_H
|
||||
#ifndef STREAM_PEER_TCP_WINSOCK_H
|
||||
#define STREAM_PEER_TCP_WINSOCK_H
|
||||
|
||||
#include "error_list.h"
|
||||
|
||||
#include "core/io/ip_address.h"
|
||||
#include "core/io/stream_peer_tcp.h"
|
||||
|
||||
class StreamPeerWinsock : public StreamPeerTCP {
|
||||
class StreamPeerTCPWinsock : public StreamPeerTCP {
|
||||
|
||||
protected:
|
||||
mutable Status status;
|
||||
@ -82,10 +82,10 @@ public:
|
||||
|
||||
virtual void set_nodelay(bool p_enabled);
|
||||
|
||||
StreamPeerWinsock();
|
||||
~StreamPeerWinsock();
|
||||
StreamPeerTCPWinsock();
|
||||
~StreamPeerTCPWinsock();
|
||||
};
|
||||
|
||||
#endif // TCP_SOCKET_POSIX_H
|
||||
#endif // STREAM_PEER_TCP_WINSOCK_H
|
||||
|
||||
#endif
|
@ -27,9 +27,11 @@
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
||||
#include "tcp_server_winsock.h"
|
||||
|
||||
#include "stream_peer_winsock.h"
|
||||
#include "stream_peer_tcp_winsock.h"
|
||||
|
||||
#include <winsock2.h>
|
||||
#include <ws2tcpip.h>
|
||||
@ -151,7 +153,7 @@ Ref<StreamPeerTCP> TCPServerWinsock::take_connection() {
|
||||
int fd = accept(listen_sockfd, (struct sockaddr *)&their_addr, &sin_size);
|
||||
ERR_FAIL_COND_V(fd == INVALID_SOCKET, NULL);
|
||||
|
||||
Ref<StreamPeerWinsock> conn = memnew(StreamPeerWinsock);
|
||||
Ref<StreamPeerTCPWinsock> conn = memnew(StreamPeerTCPWinsock);
|
||||
IP_Address ip;
|
||||
int port;
|
||||
_set_ip_addr_port(ip, port, &their_addr);
|
||||
@ -181,3 +183,5 @@ TCPServerWinsock::~TCPServerWinsock() {
|
||||
|
||||
stop();
|
||||
};
|
||||
|
||||
#endif
|
@ -27,6 +27,8 @@
|
||||
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#ifdef WINDOWS_ENABLED
|
||||
|
||||
#ifndef TCP_SERVER_WINSOCK_H
|
||||
#define TCP_SERVER_WINSOCK_H
|
||||
|
||||
@ -54,3 +56,5 @@ public:
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -386,7 +386,7 @@ int NetworkedMultiplayerENet::get_available_packet_count() const {
|
||||
|
||||
return incoming_packets.size();
|
||||
}
|
||||
Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) const {
|
||||
Error NetworkedMultiplayerENet::get_packet(const uint8_t **r_buffer, int &r_buffer_size) {
|
||||
|
||||
ERR_FAIL_COND_V(incoming_packets.size() == 0, ERR_UNAVAILABLE);
|
||||
|
||||
@ -480,7 +480,7 @@ int NetworkedMultiplayerENet::get_max_packet_size() const {
|
||||
return 1 << 24; //anything is good
|
||||
}
|
||||
|
||||
void NetworkedMultiplayerENet::_pop_current_packet() const {
|
||||
void NetworkedMultiplayerENet::_pop_current_packet() {
|
||||
|
||||
if (current_packet.packet) {
|
||||
enet_packet_destroy(current_packet.packet);
|
||||
|
@ -86,12 +86,12 @@ private:
|
||||
|
||||
CompressionMode compression_mode;
|
||||
|
||||
mutable List<Packet> incoming_packets;
|
||||
List<Packet> incoming_packets;
|
||||
|
||||
mutable Packet current_packet;
|
||||
Packet current_packet;
|
||||
|
||||
uint32_t _gen_unique_id() const;
|
||||
void _pop_current_packet() const;
|
||||
void _pop_current_packet();
|
||||
|
||||
Vector<uint8_t> src_compressor_mem;
|
||||
Vector<uint8_t> dst_compressor_mem;
|
||||
@ -123,7 +123,7 @@ public:
|
||||
virtual bool is_server() const;
|
||||
|
||||
virtual int get_available_packet_count() const;
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size) const; ///< buffer is GONE after next get_packet
|
||||
virtual Error get_packet(const uint8_t **r_buffer, int &r_buffer_size); ///< buffer is GONE after next get_packet
|
||||
virtual Error put_packet(const uint8_t *p_buffer, int p_buffer_size);
|
||||
|
||||
virtual int get_max_packet_size() const;
|
||||
|
@ -4,9 +4,6 @@ Import('env')
|
||||
|
||||
files = [
|
||||
'thread_uwp.cpp',
|
||||
'#platform/windows/tcp_server_winsock.cpp',
|
||||
'#platform/windows/packet_peer_udp_winsock.cpp',
|
||||
'#platform/windows/stream_peer_winsock.cpp',
|
||||
'#platform/windows/key_mapping_win.cpp',
|
||||
'#platform/windows/windows_terminal_logger.cpp',
|
||||
'joypad_uwp.cpp',
|
||||
|
@ -34,13 +34,13 @@
|
||||
#include "drivers/windows/dir_access_windows.h"
|
||||
#include "drivers/windows/file_access_windows.h"
|
||||
#include "drivers/windows/mutex_windows.h"
|
||||
#include "drivers/windows/packet_peer_udp_winsock.h"
|
||||
#include "drivers/windows/rw_lock_windows.h"
|
||||
#include "drivers/windows/semaphore_windows.h"
|
||||
#include "drivers/windows/stream_peer_tcp_winsock.h"
|
||||
#include "drivers/windows/tcp_server_winsock.h"
|
||||
#include "io/marshalls.h"
|
||||
#include "main/main.h"
|
||||
#include "platform/windows/packet_peer_udp_winsock.h"
|
||||
#include "platform/windows/stream_peer_winsock.h"
|
||||
#include "platform/windows/tcp_server_winsock.h"
|
||||
#include "platform/windows/windows_terminal_logger.h"
|
||||
#include "project_settings.h"
|
||||
#include "servers/audio_server.h"
|
||||
@ -163,7 +163,7 @@ void OSUWP::initialize_core() {
|
||||
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM);
|
||||
|
||||
TCPServerWinsock::make_default();
|
||||
StreamPeerWinsock::make_default();
|
||||
StreamPeerTCPWinsock::make_default();
|
||||
PacketPeerUDPWinsock::make_default();
|
||||
|
||||
// We need to know how often the clock is updated
|
||||
|
@ -19,9 +19,6 @@ common_win = [
|
||||
"os_windows.cpp",
|
||||
"ctxgl_procaddr.cpp",
|
||||
"key_mapping_win.cpp",
|
||||
"tcp_server_winsock.cpp",
|
||||
"packet_peer_udp_winsock.cpp",
|
||||
"stream_peer_winsock.cpp",
|
||||
"joypad.cpp",
|
||||
"power_windows.cpp",
|
||||
"windows_terminal_logger.cpp"
|
||||
|
@ -34,19 +34,19 @@
|
||||
#include "drivers/windows/dir_access_windows.h"
|
||||
#include "drivers/windows/file_access_windows.h"
|
||||
#include "drivers/windows/mutex_windows.h"
|
||||
#include "drivers/windows/packet_peer_udp_winsock.h"
|
||||
#include "drivers/windows/rw_lock_windows.h"
|
||||
#include "drivers/windows/semaphore_windows.h"
|
||||
#include "drivers/windows/stream_peer_tcp_winsock.h"
|
||||
#include "drivers/windows/tcp_server_winsock.h"
|
||||
#include "drivers/windows/thread_windows.h"
|
||||
#include "io/marshalls.h"
|
||||
#include "joypad.h"
|
||||
#include "lang_table.h"
|
||||
#include "main/main.h"
|
||||
#include "packet_peer_udp_winsock.h"
|
||||
#include "servers/audio_server.h"
|
||||
#include "servers/visual/visual_server_raster.h"
|
||||
#include "servers/visual/visual_server_wrap_mt.h"
|
||||
#include "stream_peer_winsock.h"
|
||||
#include "tcp_server_winsock.h"
|
||||
#include "version_generated.gen.h"
|
||||
#include "windows_terminal_logger.h"
|
||||
|
||||
@ -196,7 +196,7 @@ void OS_Windows::initialize_core() {
|
||||
DirAccess::make_default<DirAccessWindows>(DirAccess::ACCESS_FILESYSTEM);
|
||||
|
||||
TCPServerWinsock::make_default();
|
||||
StreamPeerWinsock::make_default();
|
||||
StreamPeerTCPWinsock::make_default();
|
||||
PacketPeerUDPWinsock::make_default();
|
||||
|
||||
// We need to know how often the clock is updated
|
||||
@ -1253,7 +1253,7 @@ void OS_Windows::finalize_core() {
|
||||
memdelete(process_map);
|
||||
|
||||
TCPServerWinsock::cleanup();
|
||||
StreamPeerWinsock::cleanup();
|
||||
StreamPeerTCPWinsock::cleanup();
|
||||
}
|
||||
|
||||
void OS_Windows::alert(const String &p_alert, const String &p_title) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user