Merge "Start retiring socket_loopback_client."
am: 58f7f61266
Change-Id: I2b3d6ae5e90fb99163eb639e185b93cd55ff724a
This commit is contained in:
commit
cd0e8cfd33
2 changed files with 2 additions and 19 deletions
|
|
@ -594,7 +594,7 @@ inline int _fd_set_error_str(int fd, std::string* error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int network_loopback_client(int port, int type, std::string* error) {
|
inline int network_loopback_client(int port, int type, std::string* error) {
|
||||||
return _fd_set_error_str(socket_loopback_client(port, type), error);
|
return _fd_set_error_str(socket_network_client("localhost", port, type), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int network_loopback_server(int port, int type, std::string* error) {
|
inline int network_loopback_server(int port, int type, std::string* error) {
|
||||||
|
|
|
||||||
|
|
@ -35,23 +35,6 @@
|
||||||
*/
|
*/
|
||||||
int socket_loopback_client(int port, int type)
|
int socket_loopback_client(int port, int type)
|
||||||
{
|
{
|
||||||
struct sockaddr_in addr;
|
return socket_network_client("localhost", port, type);
|
||||||
int s;
|
|
||||||
|
|
||||||
memset(&addr, 0, sizeof(addr));
|
|
||||||
addr.sin_family = AF_INET;
|
|
||||||
addr.sin_port = htons(port);
|
|
||||||
addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
|
|
||||||
|
|
||||||
s = socket(AF_INET, type, 0);
|
|
||||||
if(s < 0) return -1;
|
|
||||||
|
|
||||||
if(connect(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
|
|
||||||
close(s);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue