diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2017-01-18 12:47:12 +0100 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2017-01-23 20:18:22 +0100 |
commit | 88a56ba783d36d52a1023759e69f026b1ae255b4 (patch) | |
tree | 635ced03366a40efff9ab0689836fa9bcf75c796 /drivers/unix | |
parent | 2fe4ef66991b483640f59873c22b3af671626ccc (diff) |
Remove set_ip_type from network classes (no longer needed)
- TCP:
- `listen` bind to wildcard "*" -> dual stack socket
- `listen` bind to address -> socket from address type
- `connect` -> resolve using best protocol (UNSPEC), socket from address type
- UDP:
- `listen` bind to wildcard "*" -> dual stack socket
- `listen` bind to address -> socket from address type
- `put_packet`/`put_var` -> resolve using TYPE_ANY (UNSPEC), socket from address type
(to change socket type you must first call `close` it)
Diffstat (limited to 'drivers/unix')
-rw-r--r-- | drivers/unix/packet_peer_udp_posix.cpp | 3 | ||||
-rw-r--r-- | drivers/unix/stream_peer_tcp_posix.cpp | 6 | ||||
-rw-r--r-- | drivers/unix/stream_peer_tcp_posix.h | 2 | ||||
-rw-r--r-- | drivers/unix/tcp_server_posix.cpp | 3 |
4 files changed, 5 insertions, 9 deletions
diff --git a/drivers/unix/packet_peer_udp_posix.cpp b/drivers/unix/packet_peer_udp_posix.cpp index 15c3b7dfe9..fdd1164fbe 100644 --- a/drivers/unix/packet_peer_udp_posix.cpp +++ b/drivers/unix/packet_peer_udp_posix.cpp @@ -129,7 +129,7 @@ Error PacketPeerUDPPosix::listen(int p_port, IP_Address p_bind_address, int p_re ERR_FAIL_COND_V(sockfd!=-1,ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(),ERR_INVALID_PARAMETER); - sock_type = ip_type; + sock_type = IP::TYPE_ANY; if(p_bind_address.is_valid()) sock_type = p_bind_address.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6; @@ -271,7 +271,6 @@ PacketPeerUDPPosix::PacketPeerUDPPosix() { queue_count=0; peer_port=0; sock_type = IP::TYPE_NONE; - ip_type = IP::TYPE_ANY; } PacketPeerUDPPosix::~PacketPeerUDPPosix() { diff --git a/drivers/unix/stream_peer_tcp_posix.cpp b/drivers/unix/stream_peer_tcp_posix.cpp index 96258e63f6..3e514db245 100644 --- a/drivers/unix/stream_peer_tcp_posix.cpp +++ b/drivers/unix/stream_peer_tcp_posix.cpp @@ -122,10 +122,9 @@ Error StreamPeerTCPPosix::_poll_connection(bool p_block) const { return OK; }; -void StreamPeerTCPPosix::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_ip_type) { +void StreamPeerTCPPosix::set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type) { - ip_type = p_ip_type; - sock_type = p_ip_type; + sock_type = p_sock_type; sockfd = p_sockfd; #ifndef NO_FCNTL fcntl(sockfd, F_SETFL, O_NONBLOCK); @@ -398,7 +397,6 @@ StreamPeerTCPPosix::StreamPeerTCPPosix() { sockfd = -1; status = STATUS_NONE; peer_port = 0; - ip_type = IP::TYPE_ANY; }; StreamPeerTCPPosix::~StreamPeerTCPPosix() { diff --git a/drivers/unix/stream_peer_tcp_posix.h b/drivers/unix/stream_peer_tcp_posix.h index d33883b159..0eaa7dff3e 100644 --- a/drivers/unix/stream_peer_tcp_posix.h +++ b/drivers/unix/stream_peer_tcp_posix.h @@ -68,7 +68,7 @@ public: virtual int get_available_bytes() const; - void set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_ip_type); + void set_socket(int p_sockfd, IP_Address p_host, int p_port, IP::Type p_sock_type); virtual IP_Address get_connected_host() const; virtual uint16_t get_connected_port() const; diff --git a/drivers/unix/tcp_server_posix.cpp b/drivers/unix/tcp_server_posix.cpp index 5f3c46451a..24de7a68b1 100644 --- a/drivers/unix/tcp_server_posix.cpp +++ b/drivers/unix/tcp_server_posix.cpp @@ -74,7 +74,7 @@ Error TCPServerPosix::listen(uint16_t p_port,const IP_Address p_bind_address) { ERR_FAIL_COND_V(!p_bind_address.is_valid() && !p_bind_address.is_wildcard(), ERR_INVALID_PARAMETER); int sockfd; - sock_type = ip_type; + sock_type = IP::TYPE_ANY; // If the bind address is valid use its type as the socket type if (p_bind_address.is_valid()) @@ -184,7 +184,6 @@ void TCPServerPosix::stop() { TCPServerPosix::TCPServerPosix() { listen_sockfd = -1; - ip_type = IP::TYPE_ANY; sock_type = IP::TYPE_NONE; }; |