Commit 1e64497a authored by thorsten's avatar thorsten
Browse files

* More comments

parent ae624779
......@@ -79,15 +79,23 @@ class Relay: public Socket {
bool Send(std::string msg, std::vector<RelayRef> references);
bool Send(zmsg_t** msg, std::vector<RelayRef> references);
/**
* Closes the Relay. No more messages will be received or forwarded.
*/
void Close();
std::shared_ptr<Socket> listenFor(relay_event_type_t event_type);
/**
* Compares the (remote) target of this relay with the other's.
*
* @param other
* @return: True, if Relays have the same target
*/
bool Compare(const Relay& other);
bool Compare(const RelayRef other);
};
/**
* An Incoming Relay, which can receive message from other Relays.
*
......
......@@ -30,13 +30,28 @@ protected:
virtual void onTimeout() = 0;
virtual void onMessage(RelayRef receiver, std::string msg, std::vector<RelayRef> refs) = 0;
virtual void onClose(RelayRef receiver){};
bool onMessageInternal(RmqLoop* loop, std::shared_ptr<Socket> socket);
bool onTimeoutInternal();
public:
/**
* Stops this Subject. No more messages will be received
*
* Note: Make sure all its Relays are closed
*/
void Stop();
/**
* Creates new incoming Relay.
*
* All messages for this Relay will be directed to this subject's 'onMessage'
*
* @return: Reference to new Relay
*/
RelayRef CreateNewIncoming();
virtual ~Subject();
......
......@@ -114,6 +114,10 @@ bool Relay::Send(zmsg_t** msg, std::vector<std::shared_ptr<Relay>> references){
}
bool Relay::Compare(const RelayRef other) {
return this->Compare(*other);
}
std::shared_ptr<LocalRelay> LocalRelay::createLocalRelay(std::weak_ptr<Relay> other) {
return std::shared_ptr<LocalRelay>(new LocalRelay(other));
......
Supports Markdown
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