]> git.tdb.fi Git - libs/net.git/blobdiff - source/streamlistensocket.cpp
Hide platform specific parts of socket addresses
[libs/net.git] / source / streamlistensocket.cpp
index 3b375bcafcadb54d0581b1cf6500b82a87ca1448..681adeddb8ab95957b5eab200b718f8f3298e9a3 100644 (file)
@@ -3,6 +3,7 @@
 #include <msp/core/systemerror.h>
 #include <msp/io/handle_private.h>
 #include <msp/strings/format.h>
+#include "sockaddr_private.h"
 #include "socket_private.h"
 #include "streamlistensocket.h"
 #include "streamsocket.h"
@@ -44,12 +45,11 @@ StreamSocket *StreamListenSocket::accept()
        if(!listening)
                throw bad_socket_state("not listening");
 
-       sockaddr_storage sa;
-       socklen_t size = sizeof(sockaddr_storage);
+       SockAddr::SysAddr sa;
        Private new_p;
-       new_p.handle = ::accept(priv->handle, reinterpret_cast<sockaddr *>(&sa), &size);
+       new_p.handle = ::accept(priv->handle, reinterpret_cast<sockaddr *>(&sa.addr), &sa.size);
 
-       RefPtr<SockAddr> paddr = SockAddr::create(sa);
+       RefPtr<SockAddr> paddr = SockAddr::from_sys(sa);
        return new StreamSocket(new_p, *paddr);
 }