diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-02-18 15:01:53 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-18 15:01:53 +0100 |
commit | 27326f8238b5ba5077fff408d3b3255b356a959e (patch) | |
tree | b28c39a5a2fbc313e2a463b64bf8a6141083ed6c /drivers | |
parent | 213a85521dcac9c01e1e4746733e606b610c0db4 (diff) | |
parent | 9eea2cf9d67ed850eb9b7c8da1995ef574ba5ce1 (diff) |
Merge pull request #36296 from Faless/dtls/enet_vulkan
DTLS support + optional ENet encryption
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/unix/net_socket_posix.cpp | 4 | ||||
-rw-r--r-- | drivers/unix/net_socket_posix.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/drivers/unix/net_socket_posix.cpp b/drivers/unix/net_socket_posix.cpp index cab5513e0a..16282a15c7 100644 --- a/drivers/unix/net_socket_posix.cpp +++ b/drivers/unix/net_socket_posix.cpp @@ -544,14 +544,14 @@ Error NetSocketPosix::recv(uint8_t *p_buffer, int p_len, int &r_read) { return OK; } -Error NetSocketPosix::recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port) { +Error NetSocketPosix::recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port, bool p_peek) { ERR_FAIL_COND_V(!is_open(), ERR_UNCONFIGURED); struct sockaddr_storage from; socklen_t len = sizeof(struct sockaddr_storage); memset(&from, 0, len); - r_read = ::recvfrom(_sock, SOCK_BUF(p_buffer), p_len, 0, (struct sockaddr *)&from, &len); + r_read = ::recvfrom(_sock, SOCK_BUF(p_buffer), p_len, p_peek ? MSG_PEEK : 0, (struct sockaddr *)&from, &len); if (r_read < 0) { NetError err = _get_socket_error(); diff --git a/drivers/unix/net_socket_posix.h b/drivers/unix/net_socket_posix.h index 25ac6e2e56..0a19967265 100644 --- a/drivers/unix/net_socket_posix.h +++ b/drivers/unix/net_socket_posix.h @@ -81,7 +81,7 @@ public: virtual Error connect_to_host(IP_Address p_host, uint16_t p_port); virtual Error poll(PollType p_type, int timeout) const; virtual Error recv(uint8_t *p_buffer, int p_len, int &r_read); - virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port); + virtual Error recvfrom(uint8_t *p_buffer, int p_len, int &r_read, IP_Address &r_ip, uint16_t &r_port, bool p_peek = false); virtual Error send(const uint8_t *p_buffer, int p_len, int &r_sent); virtual Error sendto(const uint8_t *p_buffer, int p_len, int &r_sent, IP_Address p_ip, uint16_t p_port); virtual Ref<NetSocket> accept(IP_Address &r_ip, uint16_t &r_port); |