Skip to content
Snippets Groups Projects
Commit 5f7bd068 authored by Sergey Linev's avatar Sergey Linev Committed by Philippe Canal
Browse files

http: use override and remove virtual keywords

parent 1b08833e
No related branches found
No related tags found
No related merge requests found
......@@ -33,23 +33,23 @@ protected:
struct mg_connection *fWSconn;
/// True websocket requires extra thread to parallelize sending
virtual Bool_t SupportSendThrd() const { return kTRUE; }
Bool_t SupportSendThrd() const override { return kTRUE; }
public:
TCivetwebWSEngine(struct mg_connection *conn) : THttpWSEngine(), fWSconn(conn) {}
virtual ~TCivetwebWSEngine() {}
virtual ~TCivetwebWSEngine() = default;
virtual UInt_t GetId() const { return TString::Hash((void *)&fWSconn, sizeof(void *)); }
UInt_t GetId() const override { return TString::Hash((void *)&fWSconn, sizeof(void *)); }
virtual void ClearHandle(Bool_t terminate) override
void ClearHandle(Bool_t terminate) override
{
if (fWSconn && terminate)
mg_websocket_write(fWSconn, MG_WEBSOCKET_OPCODE_CONNECTION_CLOSE, nullptr, 0);
fWSconn = nullptr;
}
virtual void Send(const void *buf, int len)
void Send(const void *buf, int len) override
{
if (fWSconn)
mg_websocket_write(fWSconn, MG_WEBSOCKET_OPCODE_BINARY, (const char *)buf, len);
......@@ -59,7 +59,7 @@ public:
/// Special method to send binary data with text header
/// For normal websocket it is two separated operation, for other engines could be combined together,
/// but emulates as two messages on client side
virtual void SendHeader(const char *hdr, const void *buf, int len)
void SendHeader(const char *hdr, const void *buf, int len) override
{
if (fWSconn) {
mg_websocket_write(fWSconn, MG_WEBSOCKET_OPCODE_TEXT, hdr, strlen(hdr));
......@@ -67,7 +67,7 @@ public:
}
}
virtual void SendCharStar(const char *str)
void SendCharStar(const char *str) override
{
if (fWSconn)
mg_websocket_write(fWSconn, MG_WEBSOCKET_OPCODE_TEXT, str, strlen(str));
......
......@@ -38,19 +38,19 @@ public:
THttpLongPollEngine(bool raw = false);
virtual ~THttpLongPollEngine();
virtual UInt_t GetId() const override;
UInt_t GetId() const override;
virtual void ClearHandle(Bool_t) override;
void ClearHandle(Bool_t) override;
virtual void Send(const void *buf, int len) override;
void Send(const void *buf, int len) override;
virtual void SendCharStar(const char *buf) override;
void SendCharStar(const char *buf) override;
virtual void SendHeader(const char *hdr, const void *buf, int len) override;
void SendHeader(const char *hdr, const void *buf, int len) override;
virtual Bool_t PreProcess(std::shared_ptr<THttpCallArg> &arg) override;
Bool_t PreProcess(std::shared_ptr<THttpCallArg> &arg) override;
virtual void PostProcess(std::shared_ptr<THttpCallArg> &arg) override;
void PostProcess(std::shared_ptr<THttpCallArg> &arg) override;
};
#endif
......@@ -33,10 +33,10 @@ private:
std::thread fSendThrd; ///<! dedicated thread for all send operations
bool fHasSendThrd{false}; ///<! if any special thread was started
std::mutex fCondMutex; ///<! mutex used to access acondition
std::mutex fCondMutex; ///<! mutex used to access condition
std::condition_variable fCond; ///<! condition used to sync with sending thread
std::mutex fDataMutex; ///<! protects data submited for send operation
std::mutex fDataMutex; ///<! protects data submitted for send operation
enum { kNone, kData, kHeader, kText } fKind{kNone}; ///<! kind of operation
bool fDoingSend{false}; ///<! doing send operation in other thread
std::string fData; ///<! data (binary or text)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment