diff options
| author | Joel Klinghed <the_jk@yahoo.com> | 2015-06-09 00:21:45 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@yahoo.com> | 2015-06-09 00:21:45 +0200 |
| commit | 8f01c9a51e32891b862489e4082d2c20aa1fc883 (patch) | |
| tree | c8f21cb9768c0853da6f68decae316c1f9c7a2f5 /src/sender_client.hh | |
| parent | 913cfd1c7ef7a145036a8416d4ea815cb5cdb601 (diff) | |
Improve sender and sender_client
1) Add sockguard in sockutils.hh to help with closing sockets
2) Make sender fork in background
3) Make sender_client start a sender if needed (and sender_bin specified in config)
Diffstat (limited to 'src/sender_client.hh')
| -rw-r--r-- | src/sender_client.hh | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/sender_client.hh b/src/sender_client.hh index 5d0bd35..54339cf 100644 --- a/src/sender_client.hh +++ b/src/sender_client.hh @@ -10,12 +10,24 @@ class Config; class SenderClient { public: + class Error { + public: + virtual ~Error() {} + + virtual void error(const std::string& message) = 0; + virtual void error(const std::string& message, int error) = 0; + + protected: + Error() {} + }; + virtual ~SenderClient() {} virtual void send(const std::string& channel, const std::string& message) = 0; - static std::unique_ptr<SenderClient> create(const Config* config); + static std::unique_ptr<SenderClient> create( + const Config* config, std::shared_ptr<Error> error = nullptr); protected: SenderClient() {} |
