Fixed errors in call to 'check_ip_ver', and modified error handling
This commit is contained in:
@@ -19,8 +19,8 @@ private:
|
||||
struct sockaddr* dest = (struct sockaddr *)malloc(sizeof(struct sockaddr));
|
||||
this->sock_fd = create_local(this->ip_ver, this->protocol, this->address.data(), this->port, dest);
|
||||
if (sock_fd < 0) {
|
||||
if (sock_fd * -1 == ECONNREFUSED) {
|
||||
throw EXCEPT_CONNREFUSED;
|
||||
if (sock_fd * -1 == EADDRNOTAVAIL) {
|
||||
throw EXCEPT_ADDRNOTAVAIL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
this->address = std::string(address);
|
||||
|
||||
/* Check to see if the given IP address matches the given ip_ver */
|
||||
if ((check_ip_ver(address.data() == 4 && ip_ver == 6) || (chcek_ip_ver(address.data() == 6 && address == 4)) {
|
||||
if ((check_ip_ver(address) == 4 && ip_ver == 6) || (check_ip_ver(address) == 6 && ip_ver == 4)) {
|
||||
throw std::invalid_argument("Invalid IP address for given type.");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user