Convert validity checks of IP_Address to is_valid method.
This commit is contained in:
@@ -96,7 +96,7 @@ Error PacketPeerUDPPosix::get_packet(const uint8_t **r_buffer,int &r_buffer_size
|
||||
}
|
||||
Error PacketPeerUDPPosix::put_packet(const uint8_t *p_buffer,int p_buffer_size){
|
||||
|
||||
ERR_FAIL_COND_V(peer_addr == IP_Address(), ERR_UNCONFIGURED);
|
||||
ERR_FAIL_COND_V(!peer_addr.is_valid(), ERR_UNCONFIGURED);
|
||||
|
||||
int sock = _get_socket();
|
||||
ERR_FAIL_COND_V( sock == -1, FAILED );
|
||||
|
||||
@@ -16,7 +16,7 @@ static size_t _set_sockaddr(struct sockaddr_storage* p_addr, const IP_Address& p
|
||||
|
||||
memset(p_addr, 0, sizeof(struct sockaddr_storage));
|
||||
|
||||
ERR_FAIL_COND_V(p_ip==IP_Address(),0);
|
||||
ERR_FAIL_COND_V(!p_ip.is_valid(),0);
|
||||
|
||||
// IPv6 socket
|
||||
if (p_sock_type == IP::TYPE_IPV6 || p_sock_type == IP::TYPE_ANY) {
|
||||
|
||||
@@ -142,7 +142,7 @@ void StreamPeerTCPPosix::set_socket(int p_sockfd, IP_Address p_host, int p_port,
|
||||
|
||||
Error StreamPeerTCPPosix::connect_to_host(const IP_Address& p_host, uint16_t p_port) {
|
||||
|
||||
ERR_FAIL_COND_V( p_host == IP_Address(), ERR_INVALID_PARAMETER);
|
||||
ERR_FAIL_COND_V( !p_host.is_valid(), ERR_INVALID_PARAMETER);
|
||||
|
||||
sock_type = p_host.is_ipv4() ? IP::TYPE_IPV4 : IP::TYPE_IPV6;
|
||||
sockfd = _socket_create(sock_type, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
Reference in New Issue
Block a user