diff --git a/components/cluster/endpoint.cpp b/components/cluster/endpoint.cpp index 6eb27635d..8ba326c79 100644 --- a/components/cluster/endpoint.cpp +++ b/components/cluster/endpoint.cpp @@ -38,11 +38,6 @@ Endpoint::Endpoint(void) : m_Syncing(false) { } -Endpoint::~Endpoint(void) -{ - SetClient(Stream::Ptr()); -} - /** * Checks whether this endpoint is connected. * @@ -63,12 +58,11 @@ void Endpoint::SetClient(const Stream::Ptr& client) if (m_Client) m_Client->Close(); - m_Thread.join(); - m_Client = client; if (client) { - m_Thread = boost::thread(boost::bind(&Endpoint::MessageThreadProc, this, client)); + boost::thread thread(boost::bind(&Endpoint::MessageThreadProc, this, client)); + thread.detach(); OnConnected(GetSelf()); } diff --git a/components/cluster/endpoint.h b/components/cluster/endpoint.h index 158df7dfb..04e3a7490 100644 --- a/components/cluster/endpoint.h +++ b/components/cluster/endpoint.h @@ -42,7 +42,6 @@ public: DECLARE_TYPENAME(Endpoint); Endpoint(void); - ~Endpoint(void); static boost::signals2::signal OnConnected; static boost::signals2::signal OnMessageReceived;