Unverified Commit 7756972a authored by Igor [hyperxor]'s avatar Igor [hyperxor] Committed by GitHub

Changes in Http: make onConnection and onDisconnection methods private (#727)

parent 8b04ca8c
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <pistache/stream.h> #include <pistache/stream.h>
#include <pistache/tcp.h> #include <pistache/tcp.h>
#include <pistache/transport.h> #include <pistache/transport.h>
#include <pistache/view.h>
namespace Pistache { namespace Pistache {
namespace Tcp { namespace Tcp {
...@@ -568,9 +567,6 @@ using ResponseParser = Private::ParserImpl<Http::Response>; ...@@ -568,9 +567,6 @@ using ResponseParser = Private::ParserImpl<Http::Response>;
class Handler : public Tcp::Handler { class Handler : public Tcp::Handler {
public: public:
void onConnection(const std::shared_ptr<Tcp::Peer> &peer) override;
void onDisconnection(const std::shared_ptr<Tcp::Peer> &peer) override;
virtual void onRequest(const Request &request, ResponseWriter response) = 0; virtual void onRequest(const Request &request, ResponseWriter response) = 0;
virtual void onTimeout(const Request &request, ResponseWriter response); virtual void onTimeout(const Request &request, ResponseWriter response);
...@@ -583,6 +579,8 @@ public: ...@@ -583,6 +579,8 @@ public:
virtual ~Handler() override {} virtual ~Handler() override {}
private: private:
void onConnection(const std::shared_ptr<Tcp::Peer> &peer) override;
void onDisconnection(const std::shared_ptr<Tcp::Peer> &peer) override;
void onInput(const char *buffer, size_t len, void onInput(const char *buffer, size_t len,
const std::shared_ptr<Tcp::Peer> &peer) override; const std::shared_ptr<Tcp::Peer> &peer) override;
RequestParser &getParser(const std::shared_ptr<Tcp::Peer> &peer) const; RequestParser &getParser(const std::shared_ptr<Tcp::Peer> &peer) const;
...@@ -603,11 +601,5 @@ std::shared_ptr<H> make_handler(Args &&... args) { ...@@ -603,11 +601,5 @@ std::shared_ptr<H> make_handler(Args &&... args) {
return std::make_shared<H>(std::forward<Args>(args)...); return std::make_shared<H>(std::forward<Args>(args)...);
} }
namespace helpers {
inline Address httpAddr(const StringView &view) {
auto const str = view.toString();
return Address(str);
}
} // namespace helpers
} // namespace Http } // namespace Http
} // namespace Pistache } // namespace Pistache
...@@ -6,6 +6,8 @@ ...@@ -6,6 +6,8 @@
#pragma once #pragma once
#include <pistache/view.h>
#include <cstring> #include <cstring>
#include <limits> #include <limits>
#include <stdexcept> #include <stdexcept>
...@@ -154,6 +156,13 @@ private: ...@@ -154,6 +156,13 @@ private:
Port port_; Port port_;
}; };
namespace helpers {
inline Address httpAddr(const StringView &view) {
auto const str = view.toString();
return Address(str);
}
} // namespace helpers
class Error : public std::runtime_error { class Error : public std::runtime_error {
public: public:
explicit Error(const char *message); explicit Error(const char *message);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment