summaryrefslogtreecommitdiff
path: root/src/network/socket_handler.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-07-15 15:50:35 +0200
committerFlorent Le Coz <louiz@louiz.org>2014-07-15 15:50:35 +0200
commit6a4e17cb0a2d48695af2af488068f98515d714a1 (patch)
tree7d8dc227436394b4d32fcd3e5102a355227878ae /src/network/socket_handler.cpp
parentb578aebc039a38b9c9234af98ae106d78b48c450 (diff)
downloadbiboumi-6a4e17cb0a2d48695af2af488068f98515d714a1.tar.gz
biboumi-6a4e17cb0a2d48695af2af488068f98515d714a1.tar.bz2
biboumi-6a4e17cb0a2d48695af2af488068f98515d714a1.tar.xz
biboumi-6a4e17cb0a2d48695af2af488068f98515d714a1.zip
Fix IPv6 support (sockaddr size)
Since struct sockaddr is too small to contain an IPv6, we use struct sockaddr_in6 instead, and we cast it where needed
Diffstat (limited to 'src/network/socket_handler.cpp')
-rw-r--r--src/network/socket_handler.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/network/socket_handler.cpp b/src/network/socket_handler.cpp
index 52297e4..73e1ad1 100644
--- a/src/network/socket_handler.cpp
+++ b/src/network/socket_handler.cpp
@@ -140,7 +140,7 @@ void SocketHandler::connect(const std::string& address, const std::string& port,
this->ai_addrlen = rp->ai_addrlen;
memcpy(&this->ai_addr, rp->ai_addr, this->ai_addrlen);
memcpy(&this->addrinfo, rp, sizeof(struct addrinfo));
- this->addrinfo.ai_addr = &this->ai_addr;
+ this->addrinfo.ai_addr = reinterpret_cast<struct sockaddr*>(&this->ai_addr);
this->addrinfo.ai_next = nullptr;
// If the connection has not succeeded or failed in 5s, we consider
// it to have failed