@@ -58,12 +58,12 @@ class Endpoint
58
58
with_service_name (service);
59
59
with_addr (addr);
60
60
}
61
- Endpoint (const std::string &service, const sockaddr_in & addr)
61
+ Endpoint (const std::string &service, const sockaddr_in * addr)
62
62
{
63
63
with_service_name (service);
64
64
with_addr (addr);
65
65
}
66
- Endpoint (const std::string &service, const sockaddr_in6 & addr)
66
+ Endpoint (const std::string &service, const sockaddr_in6 * addr)
67
67
{
68
68
with_service_name (service);
69
69
with_addr (addr);
@@ -104,12 +104,12 @@ class Endpoint
104
104
/* *
105
105
* \brief with IPv4 address
106
106
*/
107
- inline Endpoint &with_addr (const struct sockaddr_in & addr);
107
+ inline Endpoint &with_addr (const struct sockaddr_in * addr);
108
108
109
109
/* *
110
110
* \brief with IPv6 address
111
111
*/
112
- inline Endpoint &with_addr (const struct sockaddr_in6 & addr);
112
+ inline Endpoint &with_addr (const struct sockaddr_in6 * addr);
113
113
114
114
/* *
115
115
* \brief with IP address
@@ -1045,19 +1045,23 @@ Endpoint &Endpoint::with_service_name(const std::string &service_name)
1045
1045
return *this ;
1046
1046
}
1047
1047
1048
- Endpoint &Endpoint::with_addr (const sockaddr_in & addr)
1048
+ Endpoint &Endpoint::with_addr (const struct sockaddr_in * addr)
1049
1049
{
1050
+ assert (addr);
1051
+
1050
1052
m_host.__isset .ipv6 = 0 ;
1051
- m_host.__set_ipv4 (addr. sin_addr .s_addr );
1052
- m_host.__set_port (addr. sin_port );
1053
+ m_host.__set_ipv4 (addr-> sin_addr .s_addr );
1054
+ m_host.__set_port (addr-> sin_port );
1053
1055
1054
1056
return *this ;
1055
1057
}
1056
1058
1057
- Endpoint &Endpoint::with_addr (const sockaddr_in6 & addr)
1059
+ Endpoint &Endpoint::with_addr (const struct sockaddr_in6 * addr)
1058
1060
{
1059
- m_host.__set_ipv6 (std::string (reinterpret_cast <const char *>(addr.sin6_addr .s6_addr ), sizeof (addr.sin6_addr )));
1060
- m_host.__set_port (addr.sin6_port );
1061
+ assert (addr);
1062
+
1063
+ m_host.__set_ipv6 (std::string (reinterpret_cast <const char *>(addr->sin6_addr .s6_addr ), sizeof (addr->sin6_addr )));
1064
+ m_host.__set_port (addr->sin6_port );
1061
1065
1062
1066
return *this ;
1063
1067
}
0 commit comments