changeset 376:e63a251515fe

Socket: default constructor initialized as Invalid
author David Demelier <markand@malikania.fr>
date Thu, 18 Jun 2015 14:21:51 +0200
parents 8a575e0afbcc
children 4885cd4dfa33
files C++/modules/Socket/Socket.h
diffstat 1 files changed, 10 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/C++/modules/Socket/Socket.h	Mon May 18 19:59:19 2015 +0200
+++ b/C++/modules/Socket/Socket.h	Thu Jun 18 14:21:51 2015 +0200
@@ -33,11 +33,6 @@
  *
  * SOCKET_NO_SSL_INIT	- (bool) Set to false if you don't want OpenSSL to be
  *			  initialized when the first SocketSsl object is created.
- *
- * SOCKET_HAVE_POLL	- (bool) Set to true if poll(2) function is available.
- *
- *			  Note: on Windows, this is automatically set if the
- *			  _WIN32_WINNT variable is greater or equal to 0x0600.
  */
 
 #include <cstdlib>
@@ -250,7 +245,7 @@
 	/* }}} */
 
 protected:
-	Handle m_handle;
+	Handle m_handle{Invalid};
 	SocketState m_state{SocketState::Opened};
 
 public:
@@ -271,6 +266,15 @@
 	static std::string syserror(int errn);
 
 	/**
+	 * This create an invalid socket.
+	 */	
+	inline Socket() noexcept
+		: m_handle(Invalid)
+		, m_state(SocketState::Closed)
+	{
+	}
+
+	/**
 	 * Construct a socket with an already created descriptor.
 	 *
 	 * @param handle the native descriptor