summaryrefslogtreecommitdiff
path: root/include/tgbot/net/TgWebhookLocalServer.h
diff options
context:
space:
mode:
authorOleg Morozenkov <m@oleg.rocks>2018-07-23 01:56:42 +0300
committerOleg Morozenkov <m@oleg.rocks>2018-07-23 01:56:42 +0300
commitd47ee877be5d1175bdc36f2d87881ddaf875a8e9 (patch)
tree7fd20cdc1236fe6b832ae980de12afd7071ebab9 /include/tgbot/net/TgWebhookLocalServer.h
parentcea20d4078f2088dea0dd589f1cc9dd7ee22461b (diff)
Refactor http clients, fix webhook server, add more samples, change tabs to 4 spaces
Diffstat (limited to 'include/tgbot/net/TgWebhookLocalServer.h')
-rw-r--r--include/tgbot/net/TgWebhookLocalServer.h26
1 files changed, 14 insertions, 12 deletions
diff --git a/include/tgbot/net/TgWebhookLocalServer.h b/include/tgbot/net/TgWebhookLocalServer.h
index 685979d..d7cb06e 100644
--- a/include/tgbot/net/TgWebhookLocalServer.h
+++ b/include/tgbot/net/TgWebhookLocalServer.h
@@ -20,8 +20,8 @@
* SOFTWARE.
*/
-#ifndef TGBOT_TGWEBHOOKTCPSERVER_H
-#define TGBOT_TGWEBHOOKTCPSERVER_H
+#ifndef TGBOT_TGWEBHOOKLOCALSERVER_H
+#define TGBOT_TGWEBHOOKLOCALSERVER_H
#ifdef BOOST_ASIO_HAS_LOCAL_SOCKETS
@@ -37,19 +37,21 @@ namespace TgBot {
class TgWebhookLocalServer : public TgWebhookServer<boost::asio::local::stream_protocol> {
public:
- TgWebhookLocalServer(std::shared_ptr<boost::asio::basic_socket_acceptor<boost::asio::local::stream_protocol>>& acceptor, const std::string& path, EventHandler* eventHandler) = delete;
-
- TgWebhookLocalServer(const std::string& path, const EventHandler* eventHandler) :
- TgWebhookServer<boost::asio::local::stream_protocol>(std::make_shared<boost::asio::basic_socket_acceptor<boost::asio::local::stream_protocol>>(_ioService, boost::asio::local::stream_protocol::endpoint(path)), path, eventHandler)
- {
- }
-
- TgWebhookLocalServer(const std::string& path, const Bot& bot) : TgWebhookLocalServer(path, &bot.getEventHandler()) {
- }
+ TgWebhookLocalServer(const std::string& unixSocketPath, const std::string& path, const EventHandler& eventHandler)
+ : TgWebhookServer<boost::asio::local::stream_protocol>(boost::asio::local::stream_protocol::endpoint(unixSocketPath),
+ path, eventHandler)
+ {
+ }
+
+ TgWebhookLocalServer(const std::string& unixSocketPath, const Bot& bot)
+ : TgWebhookServer<boost::asio::local::stream_protocol>(boost::asio::local::stream_protocol::endpoint(unixSocketPath),
+ bot)
+ {
+ }
};
}
#endif //BOOST_ASIO_HAS_LOCAL_SOCKETS
-#endif //TGBOT_TGWEBHOOKTCPSERVER_H
+#endif //TGBOT_TGWEBHOOKLOCALSERVER_H