From 8b0a89cab482de2fd46111db30833c678bce15c3 Mon Sep 17 00:00:00 2001 From: Tamaki Nishino Date: Fri, 2 Feb 2018 16:18:09 +0900 Subject: [PATCH] Make members accessible in derived class (#758) --- src/Extensions.h | 2 +- src/Group.h | 2 +- src/HTTPSocket.h | 2 +- src/Hub.h | 2 +- src/Networking.h | 2 +- src/Node.h | 3 +-- src/WebSocketProtocol.h | 2 +- 7 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/Extensions.h b/src/Extensions.h index 763b4d2cb..3f9532519 100644 --- a/src/Extensions.h +++ b/src/Extensions.h @@ -15,7 +15,7 @@ enum Options : unsigned int { template class ExtensionsNegotiator { -private: +protected: int options; public: ExtensionsNegotiator(int wantedOptions); diff --git a/src/Group.h b/src/Group.h index 91cfe442a..8159182ec 100644 --- a/src/Group.h +++ b/src/Group.h @@ -16,7 +16,7 @@ enum ListenOptions { struct Hub; template -struct WIN32_EXPORT Group : private uS::NodeData { +struct WIN32_EXPORT Group : protected uS::NodeData { protected: friend struct Hub; friend struct WebSocket; diff --git a/src/HTTPSocket.h b/src/HTTPSocket.h index 5cc7a7f31..ac1de60a3 100644 --- a/src/HTTPSocket.h +++ b/src/HTTPSocket.h @@ -126,7 +126,7 @@ struct WIN32_EXPORT HttpSocket : uS::Socket { size_t extensionsLength, const char *subprotocol, size_t subprotocolLength, bool *perMessageDeflate); -private: +protected: friend struct uS::Socket; friend struct HttpResponse; friend struct Hub; diff --git a/src/Hub.h b/src/Hub.h index 2effd0fa6..c245cfd3a 100644 --- a/src/Hub.h +++ b/src/Hub.h @@ -10,7 +10,7 @@ namespace uWS { -struct WIN32_EXPORT Hub : private uS::Node, public Group, public Group { +struct WIN32_EXPORT Hub : protected uS::Node, public Group, public Group { protected: struct ConnectionData { std::string path; diff --git a/src/Networking.h b/src/Networking.h index 4aadc5dc5..e26888cc7 100644 --- a/src/Networking.h +++ b/src/Networking.h @@ -157,7 +157,7 @@ struct Context { namespace TLS { class WIN32_EXPORT Context { -private: +protected: SSL_CTX *context = nullptr; std::shared_ptr password; diff --git a/src/Node.h b/src/Node.h index 6a146e3be..e9156cdc3 100644 --- a/src/Node.h +++ b/src/Node.h @@ -13,7 +13,7 @@ enum ListenOptions : int { }; class WIN32_EXPORT Node { -private: +protected: template static void connect_cb(Poll *p, int status, int events) { C((Socket *) p, status < 0); @@ -71,7 +71,6 @@ class WIN32_EXPORT Node { } while ((clientFd = netContext->acceptSocket(serverFd)) != INVALID_SOCKET); } -protected: Loop *loop; NodeData *nodeData; std::recursive_mutex asyncMutex; diff --git a/src/WebSocketProtocol.h b/src/WebSocketProtocol.h index 8c5b41cf8..56db71ffa 100644 --- a/src/WebSocketProtocol.h +++ b/src/WebSocketProtocol.h @@ -62,7 +62,7 @@ class WIN32_EXPORT WebSocketProtocol { static const unsigned int MEDIUM_MESSAGE_HEADER = isServer ? 8 : 4; static const unsigned int LONG_MESSAGE_HEADER = isServer ? 14 : 10; -private: +protected: static inline bool isFin(char *frame) {return *((unsigned char *) frame) & 128;} static inline unsigned char getOpCode(char *frame) {return *((unsigned char *) frame) & 15;} static inline unsigned char payloadLength(char *frame) {return ((unsigned char *) frame)[1] & 127;}