From dbe48e501cd3e3134497560eef75c90a104ff864 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Sat, 16 Jun 2012 13:06:06 +0200 Subject: [PATCH] Use specific types (rather than Object::Ptr) for event handlers. --- base/application.cpp | 2 +- base/configobject.cpp | 4 +-- base/object.cpp | 6 +++- base/object.h | 37 +++++++++++++++++++ base/objectmap.h | 2 +- base/objectset.h | 14 ++++---- base/socket.cpp | 6 ++-- base/socket.h | 10 +++--- base/tcpclient.cpp | 2 +- base/tcpclient.h | 2 +- base/tcpserver.cpp | 2 +- base/tcpserver.h | 2 +- base/timer.cpp | 4 +-- base/timer.h | 2 +- base/tlsclient.cpp | 4 +-- base/tlsclient.h | 2 +- components/configrpc/configrpccomponent.cpp | 3 +- components/configrpc/configrpccomponent.h | 2 +- components/discovery/discoverycomponent.cpp | 3 +- components/discovery/discoverycomponent.h | 2 +- dyn/configitem.cpp | 5 ++- icinga/endpoint.cpp | 2 +- icinga/endpoint.h | 4 +-- icinga/endpointmanager.cpp | 14 ++++---- icinga/endpointmanager.h | 40 ++++++++++----------- icinga/jsonrpcendpoint.cpp | 4 +-- icinga/virtualendpoint.cpp | 14 ++++---- icinga/virtualendpoint.h | 6 ++-- jsonrpc/jsonrpcclient.cpp | 2 +- jsonrpc/jsonrpcclient.h | 2 +- third-party/mmatch/mmatch.c | 2 +- 31 files changed, 122 insertions(+), 84 deletions(-) diff --git a/base/application.cpp b/base/application.cpp index 88c12a372..4ffe0e4f0 100644 --- a/base/application.cpp +++ b/base/application.cpp @@ -465,7 +465,7 @@ int Application::Run(int argc, char **argv) int result; assert(!Application::m_Instance); - Application::m_Instance = static_pointer_cast(shared_from_this()); + Application::m_Instance = GetSelf(); #ifndef _WIN32 struct sigaction sa; diff --git a/base/configobject.cpp b/base/configobject.cpp index da273b447..49b7e529f 100644 --- a/base/configobject.cpp +++ b/base/configobject.cpp @@ -90,14 +90,14 @@ bool ConfigObject::IsAbstract(void) const void ConfigObject::Commit(void) { ConfigObject::Ptr dobj = GetObject(GetType(), GetName()); - ConfigObject::Ptr self = static_pointer_cast(shared_from_this()); + ConfigObject::Ptr self = GetSelf(); assert(!dobj || dobj == self); m_Container->CheckObject(self); } void ConfigObject::Unregister(void) { - ConfigObject::Ptr self = static_pointer_cast(shared_from_this()); + ConfigObject::Ptr self = GetSelf(); m_Container->RemoveObject(self); } diff --git a/base/object.cpp b/base/object.cpp index 9e38f7e0f..924cc9842 100644 --- a/base/object.cpp +++ b/base/object.cpp @@ -44,7 +44,7 @@ Object::~Object(void) */ void Object::Hold(void) { - m_HeldObjects.push_back(shared_from_this()); + m_HeldObjects.push_back(GetSelf()); } /** @@ -55,3 +55,7 @@ void Object::ClearHeldObjects(void) m_HeldObjects.clear(); } +SharedPtrHolder Object::GetSelf(void) +{ + return SharedPtrHolder(shared_from_this()); +} diff --git a/base/object.h b/base/object.h index 573c4dc97..ca8170e33 100644 --- a/base/object.h +++ b/base/object.h @@ -23,6 +23,8 @@ namespace icinga { +class SharedPtrHolder; + /** * Base class for all heap-allocated objects. At least one of its methods * has to be virtual for RTTI to work. @@ -43,6 +45,8 @@ protected: void Hold(void); + SharedPtrHolder GetSelf(void); + private: Object(const Object& other); Object operator=(const Object& rhs); @@ -50,6 +54,39 @@ private: static vector m_HeldObjects; }; +/** + * Holds a shared pointer and provides support for implicit upcasts. + */ +class SharedPtrHolder +{ +public: + explicit SharedPtrHolder(const shared_ptr& object) + : m_Object(object) + { } + + template + operator shared_ptr(void) const + { +#ifdef _DEBUG + shared_ptr other = dynamic_pointer_cast(m_Object); + assert(other); +#else /* _DEBUG */ + shared_ptr other = static_pointer_cast(m_Object); +#endif /* _DEBUG */ + + return other; + } + + template + operator weak_ptr(void) const + { + return static_cast >(*this); + } + +private: + shared_ptr m_Object; +}; + /** * Compares a weak pointer with a raw pointer. */ diff --git a/base/objectmap.h b/base/objectmap.h index 9a6cc04b0..df9e14da0 100644 --- a/base/objectmap.h +++ b/base/objectmap.h @@ -61,7 +61,7 @@ public: Range range = GetRange(key); for (Iterator it = range.first; it != range.second; it++) { - callback(shared_from_this(), *it); + callback(GetSelf(), *it); } } diff --git a/base/objectset.h b/base/objectset.h index 394045610..8441428f9 100644 --- a/base/objectset.h +++ b/base/objectset.h @@ -55,7 +55,7 @@ public: void AddObject(const TValue& object) { m_Objects.insert(object); - OnObjectAdded(shared_from_this(), object); + OnObjectAdded(GetSelf(), object); } void RemoveObject(const TValue& object) @@ -64,7 +64,7 @@ public: if (it != m_Objects.end()) { m_Objects.erase(it); - OnObjectRemoved(shared_from_this(), object); + OnObjectRemoved(GetSelf(), object); } } @@ -81,14 +81,14 @@ public: if (!Contains(object)) { AddObject(object); } else { - OnObjectCommitted(shared_from_this(), object); + OnObjectCommitted(GetSelf(), object); } } } - boost::signal OnObjectAdded; - boost::signal OnObjectCommitted; - boost::signal OnObjectRemoved; + boost::signal::Ptr&, const TValue&)> OnObjectAdded; + boost::signal::Ptr&, const TValue&)> OnObjectCommitted; + boost::signal::Ptr&, const TValue&)> OnObjectRemoved; Iterator Begin(void) { @@ -103,7 +103,7 @@ public: void ForeachObject(function callback) { for (Iterator it = Begin(); it != End(); it++) { - callback(shared_from_this(), *it); + callback(GetSelf(), *it); } } diff --git a/base/socket.cpp b/base/socket.cpp index 6701342dd..f1f1815d2 100644 --- a/base/socket.cpp +++ b/base/socket.cpp @@ -52,7 +52,7 @@ void Socket::Start(void) OnException.connect(boost::bind(&Socket::ExceptionEventHandler, this)); - Sockets.push_back(static_pointer_cast(shared_from_this())); + Sockets.push_back(GetSelf()); } /** @@ -125,7 +125,7 @@ void Socket::CloseInternal(bool from_dtor) if (!from_dtor) { Stop(); - OnClosed(shared_from_this()); + OnClosed(GetSelf()); } } @@ -170,7 +170,7 @@ int Socket::GetLastSocketError(void) void Socket::HandleSocketError(const std::exception& ex) { if (!OnError.empty()) { - OnError(shared_from_this(), ex); + OnError(GetSelf(), ex); Close(); } else { diff --git a/base/socket.h b/base/socket.h index 0fe6316f2..aa920d44d 100644 --- a/base/socket.h +++ b/base/socket.h @@ -42,12 +42,12 @@ public: void SetFD(SOCKET fd); SOCKET GetFD(void) const; - boost::signal OnReadable; - boost::signal OnWritable; - boost::signal OnException; + boost::signal OnReadable; + boost::signal OnWritable; + boost::signal OnException; - boost::signal OnError; - boost::signal OnClosed; + boost::signal OnError; + boost::signal OnClosed; virtual bool WantsToRead(void) const; virtual bool WantsToWrite(void) const; diff --git a/base/tcpclient.cpp b/base/tcpclient.cpp index 1363ef308..43b54987f 100644 --- a/base/tcpclient.cpp +++ b/base/tcpclient.cpp @@ -159,7 +159,7 @@ void TcpClient::ReadableEventHandler(void) m_RecvQueue->Write(NULL, rc); - OnDataAvailable(shared_from_this()); + OnDataAvailable(GetSelf()); } /** diff --git a/base/tcpclient.h b/base/tcpclient.h index 2afd01942..970696d89 100644 --- a/base/tcpclient.h +++ b/base/tcpclient.h @@ -61,7 +61,7 @@ public: virtual bool WantsToRead(void) const; virtual bool WantsToWrite(void) const; - boost::signal OnDataAvailable; + boost::signal OnDataAvailable; private: TcpClientRole m_Role; diff --git a/base/tcpserver.cpp b/base/tcpserver.cpp index 876bb9168..fb559667b 100644 --- a/base/tcpserver.cpp +++ b/base/tcpserver.cpp @@ -93,7 +93,7 @@ void TcpServer::ReadableEventHandler(void) client->SetFD(fd); client->Start(); - OnNewClient(shared_from_this(), client); + OnNewClient(GetSelf(), client); } /** diff --git a/base/tcpserver.h b/base/tcpserver.h index 62b59d65f..247f66a78 100644 --- a/base/tcpserver.h +++ b/base/tcpserver.h @@ -44,7 +44,7 @@ public: void Listen(void); - boost::signal OnNewClient; + boost::signal OnNewClient; virtual bool WantsToRead(void) const; diff --git a/base/timer.cpp b/base/timer.cpp index 9d404af34..9159abe90 100644 --- a/base/timer.cpp +++ b/base/timer.cpp @@ -100,7 +100,7 @@ void Timer::CallExpiredTimers(void) */ void Timer::Call(void) { - OnTimerExpired(shared_from_this()); + OnTimerExpired(GetSelf()); } /** @@ -130,7 +130,7 @@ void Timer::Start(void) { Stop(); - Timers.push_back(static_pointer_cast(shared_from_this())); + Timers.push_back(GetSelf()); Reschedule(time(NULL) + m_Interval); } diff --git a/base/timer.h b/base/timer.h index c9ea4db0b..1c00b4ad4 100644 --- a/base/timer.h +++ b/base/timer.h @@ -52,7 +52,7 @@ public: void Reschedule(time_t next); - boost::signal OnTimerExpired; + boost::signal OnTimerExpired; private: time_t m_Interval; /**< The interval of the timer. */ diff --git a/base/tlsclient.cpp b/base/tlsclient.cpp index 065730745..3c5dde6b5 100644 --- a/base/tlsclient.cpp +++ b/base/tlsclient.cpp @@ -136,7 +136,7 @@ void TlsClient::ReadableEventHandler(void) GetRecvQueue()->Write(NULL, rc); - OnDataAvailable(shared_from_this()); + OnDataAvailable(GetSelf()); } /** @@ -244,7 +244,7 @@ int TlsClient::SSLVerifyCertificate(int ok, X509_STORE_CTX *x509Context) bool valid = false; shared_ptr x509Certificate = shared_ptr(x509Context->cert, &TlsClient::NullCertificateDeleter); - client->OnVerifyCertificate(client->shared_from_this(), valid, x509Context, x509Certificate); + client->OnVerifyCertificate(client->GetSelf(), valid, x509Context, x509Certificate); return valid ? 1 : 0; } diff --git a/base/tlsclient.h b/base/tlsclient.h index 0968fbff0..b983f619c 100644 --- a/base/tlsclient.h +++ b/base/tlsclient.h @@ -41,7 +41,7 @@ public: virtual bool WantsToRead(void) const; virtual bool WantsToWrite(void) const; - boost::signal&)> OnVerifyCertificate; + boost::signal&)> OnVerifyCertificate; protected: void HandleSSLError(void); diff --git a/components/configrpc/configrpccomponent.cpp b/components/configrpc/configrpccomponent.cpp index a3ba0e0e3..c93f67d00 100644 --- a/components/configrpc/configrpccomponent.cpp +++ b/components/configrpc/configrpccomponent.cpp @@ -69,12 +69,11 @@ void ConfigRpcComponent::NewEndpointHandler(const Endpoint::Ptr& endpoint) endpoint->OnSessionEstablished.connect(boost::bind(&ConfigRpcComponent::SessionEstablishedHandler, this, _1)); } -void ConfigRpcComponent::SessionEstablishedHandler(const Object::Ptr& source) +void ConfigRpcComponent::SessionEstablishedHandler(const Endpoint::Ptr& endpoint) { RequestMessage request; request.SetMethod("config::FetchObjects"); - Endpoint::Ptr endpoint = static_pointer_cast(source); GetEndpointManager()->SendUnicastMessage(m_ConfigRpcEndpoint, endpoint, request); } diff --git a/components/configrpc/configrpccomponent.h b/components/configrpc/configrpccomponent.h index 696f6e01c..ed73370f7 100644 --- a/components/configrpc/configrpccomponent.h +++ b/components/configrpc/configrpccomponent.h @@ -37,7 +37,7 @@ private: VirtualEndpoint::Ptr m_ConfigRpcEndpoint; void NewEndpointHandler(const Endpoint::Ptr& endpoint); - void SessionEstablishedHandler(const Object::Ptr& source); + void SessionEstablishedHandler(const Endpoint::Ptr& endpoint); void LocalObjectCommittedHandler(const ConfigObject::Ptr& object); void LocalObjectRemovedHandler(const ConfigObject::Ptr& object); diff --git a/components/discovery/discoverycomponent.cpp b/components/discovery/discoverycomponent.cpp index 78df88da7..dd86f7da6 100644 --- a/components/discovery/discoverycomponent.cpp +++ b/components/discovery/discoverycomponent.cpp @@ -170,9 +170,8 @@ bool DiscoveryComponent::GetComponentDiscoveryInfo(string component, ComponentDi * @param ea Event arguments for the component. * @returns 0 */ -void DiscoveryComponent::NewIdentityHandler(const Object::Ptr& source) +void DiscoveryComponent::NewIdentityHandler(const Endpoint::Ptr& endpoint) { - Endpoint::Ptr endpoint = static_pointer_cast(source); string identity = endpoint->GetIdentity(); if (identity == GetEndpointManager()->GetIdentity()) { diff --git a/components/discovery/discoverycomponent.h b/components/discovery/discoverycomponent.h index 39172f96f..3cb7d8692 100644 --- a/components/discovery/discoverycomponent.h +++ b/components/discovery/discoverycomponent.h @@ -57,7 +57,7 @@ private: Timer::Ptr m_DiscoveryTimer; void NewEndpointHandler(const Endpoint::Ptr& endpoint); - void NewIdentityHandler(const Object::Ptr& source); + void NewIdentityHandler(const Endpoint::Ptr& endpoint); void NewComponentMessageHandler(const RequestMessage& request); void RegisterComponentMessageHandler(const Endpoint::Ptr& sender, const RequestMessage& request); diff --git a/dyn/configitem.cpp b/dyn/configitem.cpp index 24dde96c6..96ab331f2 100644 --- a/dyn/configitem.cpp +++ b/dyn/configitem.cpp @@ -128,7 +128,7 @@ void ConfigItem::Commit(void) dobj->Commit(); ConfigItem::Ptr ci = GetObject(GetType(), GetName()); - ConfigItem::Ptr self = static_pointer_cast(shared_from_this()); + ConfigItem::Ptr self = GetSelf(); if (ci && ci != self) { ci->m_ConfigObject.reset(); GetAllObjects()->RemoveObject(ci); @@ -140,8 +140,7 @@ void ConfigItem::Unregister(void) { // TODO: unregister associated ConfigObject - ConfigItem::Ptr self = static_pointer_cast(shared_from_this()); - GetAllObjects()->RemoveObject(self); + GetAllObjects()->RemoveObject(GetSelf()); } ConfigItem::Ptr ConfigItem::GetObject(const string& type, const string& name) diff --git a/icinga/endpoint.cpp b/icinga/endpoint.cpp index 980693137..3d2ab177f 100644 --- a/icinga/endpoint.cpp +++ b/icinga/endpoint.cpp @@ -48,7 +48,7 @@ string Endpoint::GetIdentity(void) const void Endpoint::SetIdentity(string identity) { m_Identity = identity; - OnIdentityChanged(shared_from_this()); + OnIdentityChanged(GetSelf()); } /** diff --git a/icinga/endpoint.h b/icinga/endpoint.h index 46848cd28..2f14b3116 100644 --- a/icinga/endpoint.h +++ b/icinga/endpoint.h @@ -79,8 +79,8 @@ public: ConstTopicIterator BeginPublications(void) const; ConstTopicIterator EndPublications(void) const; - boost::signal OnIdentityChanged; - boost::signal OnSessionEstablished; + boost::signal OnIdentityChanged; + boost::signal OnSessionEstablished; private: string m_Identity; /**< The identity of this endpoint. */ diff --git a/icinga/endpointmanager.cpp b/icinga/endpointmanager.cpp index c3b11d59a..b95f88a2b 100644 --- a/icinga/endpointmanager.cpp +++ b/icinga/endpointmanager.cpp @@ -150,10 +150,10 @@ void EndpointManager::RegisterEndpoint(Endpoint::Ptr endpoint) if (!endpoint->IsLocal() && endpoint->GetIdentity() != "") throw invalid_argument("Identity must be empty."); - endpoint->SetEndpointManager(static_pointer_cast(shared_from_this())); + endpoint->SetEndpointManager(GetSelf()); m_Endpoints.push_back(endpoint); - OnNewEndpoint(shared_from_this(), endpoint); + OnNewEndpoint(GetSelf(), endpoint); } /** @@ -253,14 +253,14 @@ void EndpointManager::SendMulticastMessage(Endpoint::Ptr sender, * * @param callback The callback function. */ -void EndpointManager::ForEachEndpoint(function callback) +void EndpointManager::ForEachEndpoint(function callback) { vector::iterator prev, i; for (i = m_Endpoints.begin(); i != m_Endpoints.end(); ) { prev = i; i++; - callback(shared_from_this(), *prev); + callback(GetSelf(), *prev); } } @@ -282,7 +282,7 @@ Endpoint::Ptr EndpointManager::GetEndpointByIdentity(string identity) const void EndpointManager::SendAPIMessage(Endpoint::Ptr sender, RequestMessage& message, - function callback, time_t timeout) + function callback, time_t timeout) { m_NextMessageID++; @@ -337,7 +337,7 @@ void EndpointManager::RequestTimerHandler(void) map::iterator it; for (it = m_Requests.begin(); it != m_Requests.end(); it++) { if (it->second.HasTimedOut()) { - it->second.Callback(shared_from_this(), Endpoint::Ptr(), it->second.Request, ResponseMessage(), true); + it->second.Callback(GetSelf(), Endpoint::Ptr(), it->second.Request, ResponseMessage(), true); m_Requests.erase(it); @@ -360,7 +360,7 @@ void EndpointManager::ProcessResponseMessage(const Endpoint::Ptr& sender, const if (it == m_Requests.end()) return; - it->second.Callback(shared_from_this(), sender, it->second.Request, message, false); + it->second.Callback(GetSelf(), sender, it->second.Request, message, false); m_Requests.erase(it); RescheduleRequestTimer(); diff --git a/icinga/endpointmanager.h b/icinga/endpointmanager.h index 7c31740b4..d91128315 100644 --- a/icinga/endpointmanager.h +++ b/icinga/endpointmanager.h @@ -23,23 +23,6 @@ namespace icinga { -/** - * Information about a pending API request. - * - * @ingroup icinga - */ -struct I2_ICINGA_API PendingRequest -{ - time_t Timeout; - RequestMessage Request; - function Callback; - - bool HasTimedOut(void) const - { - return time(NULL) > Timeout; - } -}; - /** * Forwards messages between endpoints. * @@ -72,15 +55,15 @@ public: void SendMulticastMessage(Endpoint::Ptr sender, const RequestMessage& message); void SendAPIMessage(Endpoint::Ptr sender, RequestMessage& message, - function callback, time_t timeout = 10); + function callback, time_t timeout = 10); void ProcessResponseMessage(const Endpoint::Ptr& sender, const ResponseMessage& message); - void ForEachEndpoint(function callback); + void ForEachEndpoint(function callback); Endpoint::Ptr GetEndpointByIdentity(string identity) const; - boost::signal OnNewEndpoint; + boost::signal OnNewEndpoint; private: string m_Identity; @@ -89,6 +72,23 @@ private: vector m_Servers; vector m_Endpoints; + /** + * Information about a pending API request. + * + * @ingroup icinga + */ + struct I2_ICINGA_API PendingRequest + { + time_t Timeout; + RequestMessage Request; + function Callback; + + bool HasTimedOut(void) const + { + return time(NULL) > Timeout; + } + }; + long m_NextMessageID; map m_Requests; Timer::Ptr m_RequestTimer; diff --git a/icinga/jsonrpcendpoint.cpp b/icinga/jsonrpcendpoint.cpp index a9dfc1f73..87fd61a7d 100644 --- a/icinga/jsonrpcendpoint.cpp +++ b/icinga/jsonrpcendpoint.cpp @@ -82,7 +82,7 @@ void JsonRpcEndpoint::ProcessResponse(Endpoint::Ptr sender, const ResponseMessag void JsonRpcEndpoint::NewMessageHandler(const MessagePart& message) { - Endpoint::Ptr sender = static_pointer_cast(shared_from_this()); + Endpoint::Ptr sender = GetSelf(); if (ResponseMessage::IsResponseMessage(message)) { /* rather than routing the message to the right virtual @@ -121,7 +121,7 @@ void JsonRpcEndpoint::ClientClosedHandler(void) // remove the endpoint if there are no more subscriptions */ if (BeginSubscriptions() == EndSubscriptions()) { Hold(); - GetEndpointManager()->UnregisterEndpoint(static_pointer_cast(shared_from_this())); + GetEndpointManager()->UnregisterEndpoint(GetSelf()); } m_Client.reset(); diff --git a/icinga/virtualendpoint.cpp b/icinga/virtualendpoint.cpp index 02ff52efe..be3f32958 100644 --- a/icinga/virtualendpoint.cpp +++ b/icinga/virtualendpoint.cpp @@ -38,15 +38,15 @@ bool VirtualEndpoint::IsConnected(void) const return true; } -void VirtualEndpoint::RegisterTopicHandler(string topic, function callback) +void VirtualEndpoint::RegisterTopicHandler(string topic, function callback) { - map > >::iterator it; + map > >::iterator it; it = m_TopicHandlers.find(topic); - shared_ptr > sig; + shared_ptr > sig; if (it == m_TopicHandlers.end()) { - sig = boost::make_shared >(); + sig = boost::make_shared >(); m_TopicHandlers.insert(make_pair(topic, sig)); } else { sig = it->second; @@ -57,7 +57,7 @@ void VirtualEndpoint::RegisterTopicHandler(string topic, function callback) +void VirtualEndpoint::UnregisterTopicHandler(string topic, function callback) { // TODO: implement //m_TopicHandlers[method] -= callback; @@ -72,13 +72,13 @@ void VirtualEndpoint::ProcessRequest(Endpoint::Ptr sender, const RequestMessage& if (!request.GetMethod(&method)) return; - map > >::iterator it; + map > >::iterator it; it = m_TopicHandlers.find(method); if (it == m_TopicHandlers.end()) return; - (*it->second)(shared_from_this(), sender, request); + (*it->second)(GetSelf(), sender, request); } void VirtualEndpoint::ProcessResponse(Endpoint::Ptr sender, const ResponseMessage& response) diff --git a/icinga/virtualendpoint.h b/icinga/virtualendpoint.h index 4da70c053..ddc080c27 100644 --- a/icinga/virtualendpoint.h +++ b/icinga/virtualendpoint.h @@ -34,8 +34,8 @@ public: typedef shared_ptr Ptr; typedef weak_ptr WeakPtr; - void RegisterTopicHandler(string topic, function callback); - void UnregisterTopicHandler(string topic, function callback); + void RegisterTopicHandler(string topic, function callback); + void UnregisterTopicHandler(string topic, function callback); virtual string GetAddress(void) const; @@ -48,7 +48,7 @@ public: virtual void Stop(void); private: - map< string, shared_ptr > > m_TopicHandlers; + map< string, shared_ptr > > m_TopicHandlers; }; } diff --git a/jsonrpc/jsonrpcclient.cpp b/jsonrpc/jsonrpcclient.cpp index e35e76f08..c95b049b1 100644 --- a/jsonrpc/jsonrpcclient.cpp +++ b/jsonrpc/jsonrpcclient.cpp @@ -57,7 +57,7 @@ void JsonRpcClient::DataAvailableHandler(void) return; message = MessagePart(jsonString); - OnNewMessage(shared_from_this(), message); + OnNewMessage(GetSelf(), message); } catch (const Exception& ex) { Application::Log(LogCritical, "jsonrpc", "Exception while processing message from JSON-RPC client: " + string(ex.GetMessage())); Close(); diff --git a/jsonrpc/jsonrpcclient.h b/jsonrpc/jsonrpcclient.h index a8f962884..00a16ada1 100644 --- a/jsonrpc/jsonrpcclient.h +++ b/jsonrpc/jsonrpcclient.h @@ -38,7 +38,7 @@ public: void SendMessage(const MessagePart& message); - boost::signal OnNewMessage; + boost::signal OnNewMessage; private: void DataAvailableHandler(void); diff --git a/third-party/mmatch/mmatch.c b/third-party/mmatch/mmatch.c index 704f33abf..e6fb1093f 100644 --- a/third-party/mmatch/mmatch.c +++ b/third-party/mmatch/mmatch.c @@ -301,6 +301,6 @@ char *collapse(char *pattern) } while (*m++); }; - return mask; + return pattern; }