Client: move message functions into the class
This commit is contained in:
@@ -86,11 +86,6 @@ public:
|
||||
return FullyBufferedSocket::IsDefined();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
bool IsSubscribed(const char *channel_name) const {
|
||||
return subscriptions.find(channel_name) != subscriptions.end();
|
||||
}
|
||||
|
||||
gcc_pure
|
||||
bool IsExpired() const {
|
||||
return !FullyBufferedSocket::IsDefined();
|
||||
@@ -132,6 +127,30 @@ public:
|
||||
void IdleAdd(unsigned flags);
|
||||
bool IdleWait(unsigned flags);
|
||||
|
||||
enum class SubscribeResult {
|
||||
/** success */
|
||||
OK,
|
||||
|
||||
/** invalid channel name */
|
||||
INVALID,
|
||||
|
||||
/** already subscribed to this channel */
|
||||
ALREADY,
|
||||
|
||||
/** too many subscriptions */
|
||||
FULL,
|
||||
};
|
||||
|
||||
gcc_pure
|
||||
bool IsSubscribed(const char *channel_name) const {
|
||||
return subscriptions.find(channel_name) != subscriptions.end();
|
||||
}
|
||||
|
||||
SubscribeResult Subscribe(const char *channel);
|
||||
bool Unsubscribe(const char *channel);
|
||||
void UnsubscribeAll();
|
||||
bool PushMessage(const ClientMessage &msg);
|
||||
|
||||
private:
|
||||
/* virtual methods from class BufferedSocket */
|
||||
virtual InputResult OnSocketInput(void *data, size_t length) override;
|
||||
|
Reference in New Issue
Block a user