lock.lock();
+ if (GetFD() == INVALID_SOCKET)
+ return;
+
if (rc < 0) {
HandleSocketError(SocketException("select() failed", GetError()));
return;
lock.lock();
+ if (GetFD() == INVALID_SOCKET)
+ return;
+
if (rc < 0) {
HandleSocketError(SocketException("select() failed", GetError()));
return;
typedef shared_ptr<Socket> Ptr;
typedef weak_ptr<Socket> WeakPtr;
- //typedef list<Socket::WeakPtr> CollectionType;
-
- //static Socket::CollectionType Sockets;
-
~Socket(void);
- //boost::signal<void (const Socket::Ptr&)> OnReadable;
- //boost::signal<void (const Socket::Ptr&)> OnWritable;
- //boost::signal<void (const Socket::Ptr&)> OnException;
-
boost::signal<void (const Socket::Ptr&, const std::exception&)> OnError;
boost::signal<void (const Socket::Ptr&)> OnClosed;
virtual void Start(void);
- //virtual void Stop(void);
void Close(void);
void DelegationComponent::Start(void)
{
m_AllServices = boost::make_shared<ConfigObject::Set>(ConfigObject::GetAllObjects(), ConfigObject::MakeTypePredicate("service"));
+ m_AllServices->OnObjectCommitted.connect(boost::bind(&DelegationComponent::ObjectCommittedHandler, this, _2));
m_AllServices->Start();
m_DelegationTimer = boost::make_shared<Timer>();
mgr->UnregisterEndpoint(m_DelegationEndpoint);
}
+void DelegationComponent::ObjectCommittedHandler(const ConfigObject::Ptr& object)
+{
+ Service service(object);
+
+ /* object was updated, clear its checker to make sure it's re-delegated by the delegation timer */
+ service.SetChecker("");
+}
+
void DelegationComponent::AssignService(const Endpoint::Ptr& checker, const Service& service)
{
RequestMessage request;
void NewEndpointHandler(const Endpoint::Ptr& endpoint);
void SessionEstablishedHandler(const Endpoint::Ptr& endpoint);
+ void ObjectCommittedHandler(const ConfigObject::Ptr& object);
void DelegationTimerHandler(void);
vector<Endpoint::Ptr> GetCheckerCandidates(const Service& service) const;