Repaired subscription functions with new Subscription object parameters.
This commit is contained in:
parent
5f61a2280d
commit
b4fd28e41a
@ -12,7 +12,9 @@ namespace core {
|
||||
: id(id), mode(mode), owner(&session), handler(NULL) {}
|
||||
|
||||
Subscription::Subscription(std::string id, TCPSession &session, std::string mode, SubscriptionHandler *handler)
|
||||
: id(id), mode(mode), owner(&session), handler(handler) {}
|
||||
: id(id), mode(mode), owner(&session), handler(handler) {
|
||||
// coreutils::Log(coreutils::LOG_DEBUG_3) << "Subscription '" << id << "' with handler '" << handler->name << "'";
|
||||
}
|
||||
|
||||
Subscription::~Subscription() {
|
||||
std::stringstream out;
|
||||
|
@ -7,14 +7,6 @@
|
||||
|
||||
namespace core {
|
||||
|
||||
SubscriptionManager::SubscriptionManager() {
|
||||
factory = new SubscriptionHandlerFactory();
|
||||
}
|
||||
|
||||
SubscriptionManager::~SubscriptionManager() {
|
||||
delete factory;
|
||||
}
|
||||
|
||||
int SubscriptionManager::add(Subscription &subscription) {
|
||||
lock.lock();
|
||||
subscriptions.insert(std::make_pair(subscription.id, &subscription));
|
||||
@ -56,7 +48,10 @@ namespace core {
|
||||
|
||||
int SubscriptionManager::processCommand(coreutils::ZString &request, TCPSession &session) {
|
||||
if (request[0].equals("publish")) {
|
||||
SubscriptionHandler *handler = factory->getSubscriptionHandler(request[3].str());
|
||||
SubscriptionHandler *handler = NULL;
|
||||
if(request.getList().size() > 3) {
|
||||
factory->getSubscriptionHandler(request[3].str());
|
||||
}
|
||||
newSubscription = new Subscription(request[1].str(), session, request[2].str(), handler);
|
||||
subscriptions.insert(std::make_pair(request[1].str(), newSubscription));
|
||||
return 1;
|
||||
|
@ -16,14 +16,12 @@ namespace core {
|
||||
class SubscriptionManager : public Command {
|
||||
|
||||
public:
|
||||
SubscriptionManager();
|
||||
virtual ~SubscriptionManager();
|
||||
|
||||
int add(Subscription &subscription);
|
||||
int removeSessionSubscriptions(TCPSession &session);
|
||||
int processCommand(coreutils::ZString &request, TCPSession &session) override;
|
||||
|
||||
SubscriptionHandlerFactory *factory;
|
||||
SubscriptionHandlerFactory *factory = NULL;
|
||||
|
||||
private:
|
||||
Subscription *subscription;
|
||||
|
Loading…
x
Reference in New Issue
Block a user