fixed SF# 3522906: Unregistering handlers from SocketReactor

This commit is contained in:
Aleksandar Fabijanic
2012-05-04 03:39:24 +00:00
parent 8b7c37a837
commit 369ca9cd52
9 changed files with 170 additions and 23 deletions

View File

@@ -69,7 +69,10 @@ public:
/// Adds the given observer.
void removeObserver(SocketReactor* pReactor, const Poco::AbstractObserver& observer);
/// Removes the given observer.
/// Removes the given observer.
bool hasObserver(const Poco::AbstractObserver& observer) const;
/// Returns true if the given observer is registered.
bool accepts(SocketNotification* pNotification);
/// Returns true if there is at least one observer for the given notification.
@@ -105,6 +108,12 @@ inline bool SocketNotifier::accepts(SocketNotification* pNotification)
}
inline bool SocketNotifier::hasObserver(const Poco::AbstractObserver& observer) const
{
return _nc.hasObserver(observer);
}
inline bool SocketNotifier::hasObservers() const
{
return _nc.hasObservers();

View File

@@ -169,6 +169,9 @@ public:
/// Poco::Observer<MyEventHandler, SocketNotification> obs(*this, &MyEventHandler::handleMyEvent);
/// reactor.addEventHandler(obs);
bool hasEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
/// Returns true if the observer is reistered with SocketReactor for the given socket.
void removeEventHandler(const Socket& socket, const Poco::AbstractObserver& observer);
/// Unregisters an event handler with the SocketReactor.
///