changeset 441:21f1a6ed0570

Socket: the full Socket constructor must also call create
author David Demelier <markand@malikania.fr>
date Fri, 23 Oct 2015 08:19:09 +0200
parents 738751252248
children 44887104242a
files C++/modules/Socket/Sockets.h
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/C++/modules/Socket/Sockets.h	Fri Oct 23 08:16:03 2015 +0200
+++ b/C++/modules/Socket/Sockets.h	Fri Oct 23 08:19:09 2015 +0200
@@ -428,7 +428,7 @@
 	 * @param type the type of socket implementation
 	 */
 	explicit inline Socket(Handle handle, Type type = Type{}) noexcept
-		: m_type(std::move(type))
+		: m_type{std::move(type)}
 		, m_handle{handle}
 	{
 	}
@@ -439,9 +439,11 @@
 	 * @param domain the domain AF_*
 	 * @param type the type SOCK_*
 	 * @param protocol the protocol
+	 * @param iface the implementation
 	 * @throw Error on failures
 	 */
-	Socket(int domain, int type, int protocol)
+	Socket(int domain, int type, int protocol, Type iface = Type{})
+		: m_type{std::move(iface)}
 	{
 #if !defined(SOCKET_NO_AUTO_INIT)
 		init();
@@ -451,6 +453,8 @@
 		if (m_handle == Invalid) {
 			throw Error{Error::System, "socket"};
 		}
+
+		m_type.create(*this);
 	}
 
 	/**