net/SocketAddress: light wrapper for struct sockaddr
This commit is contained in:
@@ -19,25 +19,19 @@
|
||||
|
||||
#include "config.h"
|
||||
#include "SocketUtil.hxx"
|
||||
#include "SocketAddress.hxx"
|
||||
#include "SocketError.hxx"
|
||||
#include "system/fd_util.h"
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <sys/socket.h>
|
||||
#else
|
||||
#include <ws2tcpip.h>
|
||||
#include <winsock.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_IPV6
|
||||
#include <string.h>
|
||||
#endif
|
||||
|
||||
int
|
||||
socket_bind_listen(int domain, int type, int protocol,
|
||||
const struct sockaddr *address, size_t address_length,
|
||||
SocketAddress address,
|
||||
int backlog,
|
||||
Error &error)
|
||||
{
|
||||
@@ -60,7 +54,7 @@ socket_bind_listen(int domain, int type, int protocol,
|
||||
return -1;
|
||||
}
|
||||
|
||||
ret = bind(fd, address, address_length);
|
||||
ret = bind(fd, address.GetAddress(), address.GetSize());
|
||||
if (ret < 0) {
|
||||
SetSocketError(error);
|
||||
close_socket(fd);
|
||||
|
||||
Reference in New Issue
Block a user