Browse Source

Fixed compilation on Windows

Paul-Louis Ageneau 4 years ago
parent
commit
c4cb061e14
3 changed files with 5 additions and 5 deletions
  1. 1 1
      src/impl/tcpserver.cpp
  2. 2 2
      src/impl/tcptransport.cpp
  3. 2 2
      src/impl/websocket.cpp

+ 1 - 1
src/impl/tcpserver.cpp

@@ -122,7 +122,7 @@ void TcpServer::listen(uint16_t port) {
 			             sizeof(disabled));
 
 		// Set non-blocking
-		const ctl_t b = 1;
+		ctl_t b = 1;
 		if (::ioctlsocket(mSock, FIONBIO, &b) < 0)
 			throw std::runtime_error("Failed to set socket non-blocking mode");
 

+ 2 - 2
src/impl/tcptransport.cpp

@@ -41,7 +41,7 @@ TcpTransport::TcpTransport(socket_t sock, state_callback callback)
 	PLOG_DEBUG << "Initializing TCP transport with socket";
 
 	// Set non-blocking
-	const ctl_t b = 1;
+	ctl_t b = 1;
 	if (::ioctlsocket(mSock, FIONBIO, &b) < 0)
 		throw std::runtime_error("Failed to set socket non-blocking mode");
 
@@ -169,7 +169,7 @@ void TcpTransport::connect(const sockaddr *addr, socklen_t addrlen) {
 			throw std::runtime_error("TCP socket creation failed");
 
 		// Set non-blocking
-		const ctl_t b = 1;
+		ctl_t b = 1;
 		if (::ioctlsocket(mSock, FIONBIO, &b) < 0)
 			throw std::runtime_error("Failed to set socket non-blocking mode");
 

+ 2 - 2
src/impl/websocket.cpp

@@ -263,7 +263,8 @@ shared_ptr<TlsTransport> WebSocket::initTlsTransport() {
 		if (std::exchange(verify, false)) {
 			PLOG_WARNING << "TLS certificate verification with root CA is not supported on Windows";
 		}
-#else
+#endif
+
 		shared_ptr<TlsTransport> transport;
 		if (verify)
 			transport = std::make_shared<VerifiedTlsTransport>(lower, mHostname.value(), mCertificate,
@@ -271,7 +272,6 @@ shared_ptr<TlsTransport> WebSocket::initTlsTransport() {
 		else
 			transport =
 			    std::make_shared<TlsTransport>(lower, mHostname, mCertificate, stateChangeCallback);
-#endif
 
 		std::atomic_store(&mTlsTransport, transport);
 		if (state == WebSocket::State::Closed) {