2
0
Эх сурвалжийг харах

fixed build failed for macos

홍학규 4 жил өмнө
parent
commit
6aff5dc5bc

+ 1 - 1
include/rtc/websocket.hpp

@@ -49,7 +49,7 @@ public:
 
 	struct Configuration {
 		bool disableTlsVerification = false; // if true, don't verify the TLS certificate
-		std::vector<string> protocols;
+		std::optional<std::vector<string>> protocols = std::nullopt;
 	};
 
 	WebSocket(std::optional<Configuration> config = nullopt);

+ 7 - 1
src/websocket.cpp

@@ -287,8 +287,14 @@ shared_ptr<WsTransport> WebSocket::initWsTransport() {
 		shared_ptr<Transport> lower = std::atomic_load(&mTlsTransport);
 		if (!lower)
 			lower = std::atomic_load(&mTcpTransport);
+
+		auto wsConfig = WsTransport::Configuration();
+		if(mConfig.protocols) {
+			wsConfig.protocols = *mConfig.protocols;
+		}
+
 		auto transport = std::make_shared<WsTransport>(
-			WsTransport::Configuration{{.protocols = mConfig.protocols}},
+			wsConfig,
 		    lower, mHost, mPath, weak_bind(&WebSocket::incoming, this, _1),
 		    [this, weak_this = weak_from_this()](State state) {
 			    auto shared_this = weak_this.lock();