summaryrefslogtreecommitdiffstats
path: root/src/OSSupport
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/OSSupport/HostnameLookup.cpp2
-rw-r--r--src/OSSupport/IPLookup.cpp4
-rw-r--r--src/OSSupport/Network.h2
-rw-r--r--src/OSSupport/NetworkSingleton.cpp4
-rw-r--r--src/OSSupport/NetworkSingleton.h4
-rw-r--r--src/OSSupport/ServerHandleImpl.cpp10
-rw-r--r--src/OSSupport/TCPLinkImpl.cpp16
7 files changed, 21 insertions, 21 deletions
diff --git a/src/OSSupport/HostnameLookup.cpp b/src/OSSupport/HostnameLookup.cpp
index 122689f59..d86430d83 100644
--- a/src/OSSupport/HostnameLookup.cpp
+++ b/src/OSSupport/HostnameLookup.cpp
@@ -16,7 +16,7 @@
// cHostnameLookup:
cHostnameLookup::cHostnameLookup(const AString & a_Hostname, cNetwork::cResolveNameCallbacksPtr a_Callbacks):
- m_Callbacks(a_Callbacks),
+ m_Callbacks(std::move(a_Callbacks)),
m_Hostname(a_Hostname)
{
}
diff --git a/src/OSSupport/IPLookup.cpp b/src/OSSupport/IPLookup.cpp
index 7b543793d..f730110b9 100644
--- a/src/OSSupport/IPLookup.cpp
+++ b/src/OSSupport/IPLookup.cpp
@@ -17,10 +17,10 @@
// cIPLookup:
cIPLookup::cIPLookup(const AString & a_IP, cNetwork::cResolveNameCallbacksPtr a_Callbacks):
- m_Callbacks(a_Callbacks),
+ m_Callbacks(std::move(a_Callbacks)),
m_IP(a_IP)
{
- ASSERT(a_Callbacks != nullptr);
+ ASSERT(m_Callbacks != nullptr);
}
diff --git a/src/OSSupport/Network.h b/src/OSSupport/Network.h
index 3c4470848..8e3f20025 100644
--- a/src/OSSupport/Network.h
+++ b/src/OSSupport/Network.h
@@ -132,7 +132,7 @@ protected:
/** Creates a new link, with the specified callbacks. */
cTCPLink(cCallbacksPtr a_Callbacks):
- m_Callbacks(a_Callbacks)
+ m_Callbacks(std::move(a_Callbacks))
{
}
};
diff --git a/src/OSSupport/NetworkSingleton.cpp b/src/OSSupport/NetworkSingleton.cpp
index 0d8ba31e6..95de0e7b5 100644
--- a/src/OSSupport/NetworkSingleton.cpp
+++ b/src/OSSupport/NetworkSingleton.cpp
@@ -182,7 +182,7 @@ void cNetworkSingleton::SignalizeStartup(evutil_socket_t a_Socket, short a_Event
-void cNetworkSingleton::AddLink(cTCPLinkPtr a_Link)
+void cNetworkSingleton::AddLink(const cTCPLinkPtr & a_Link)
{
ASSERT(!m_HasTerminated);
cCSLock Lock(m_CS);
@@ -211,7 +211,7 @@ void cNetworkSingleton::RemoveLink(const cTCPLink * a_Link)
-void cNetworkSingleton::AddServer(cServerHandlePtr a_Server)
+void cNetworkSingleton::AddServer(const cServerHandlePtr & a_Server)
{
ASSERT(!m_HasTerminated);
cCSLock Lock(m_CS);
diff --git a/src/OSSupport/NetworkSingleton.h b/src/OSSupport/NetworkSingleton.h
index 4bcd58745..2a2d0cef3 100644
--- a/src/OSSupport/NetworkSingleton.h
+++ b/src/OSSupport/NetworkSingleton.h
@@ -61,7 +61,7 @@ public:
/** Adds the specified link to m_Connections.
Used by the underlying link implementation when a new link is created. */
- void AddLink(cTCPLinkPtr a_Link);
+ void AddLink(const cTCPLinkPtr & a_Link);
/** Removes the specified link from m_Connections.
Used by the underlying link implementation when the link is closed / errored. */
@@ -70,7 +70,7 @@ public:
/** Adds the specified link to m_Servers.
Used by the underlying server handle implementation when a new listening server is created.
Only servers that succeed in listening are added. */
- void AddServer(cServerHandlePtr a_Server);
+ void AddServer(const cServerHandlePtr & a_Server);
/** Removes the specified server from m_Servers.
Used by the underlying server handle implementation when the server is closed. */
diff --git a/src/OSSupport/ServerHandleImpl.cpp b/src/OSSupport/ServerHandleImpl.cpp
index 371125227..fb5e16216 100644
--- a/src/OSSupport/ServerHandleImpl.cpp
+++ b/src/OSSupport/ServerHandleImpl.cpp
@@ -32,7 +32,7 @@ static bool IsValidSocket(evutil_socket_t a_Socket)
// cServerHandleImpl:
cServerHandleImpl::cServerHandleImpl(cNetwork::cListenCallbacksPtr a_ListenCallbacks):
- m_ListenCallbacks(a_ListenCallbacks),
+ m_ListenCallbacks(std::move(a_ListenCallbacks)),
m_ConnListener(nullptr),
m_SecondaryConnListener(nullptr),
m_IsListening(false),
@@ -79,7 +79,7 @@ void cServerHandleImpl::Close(void)
cCSLock Lock(m_CS);
std::swap(Conns, m_Connections);
}
- for (auto conn: Conns)
+ for (const auto & conn: Conns)
{
conn->Shutdown();
}
@@ -100,7 +100,7 @@ cServerHandleImplPtr cServerHandleImpl::Listen(
cNetwork::cListenCallbacksPtr a_ListenCallbacks
)
{
- cServerHandleImplPtr res = cServerHandleImplPtr{new cServerHandleImpl(a_ListenCallbacks)};
+ cServerHandleImplPtr res{new cServerHandleImpl(std::move(a_ListenCallbacks))};
res->m_SelfPtr = res;
if (res->Listen(a_Port))
{
@@ -108,7 +108,7 @@ cServerHandleImplPtr cServerHandleImpl::Listen(
}
else
{
- a_ListenCallbacks->OnError(res->m_ErrorCode, res->m_ErrorMsg);
+ res->m_ListenCallbacks->OnError(res->m_ErrorCode, res->m_ErrorMsg);
res->m_SelfPtr.reset();
}
return res;
@@ -363,7 +363,7 @@ cServerHandlePtr cNetwork::Listen(
cNetwork::cListenCallbacksPtr a_ListenCallbacks
)
{
- return cServerHandleImpl::Listen(a_Port, a_ListenCallbacks);
+ return cServerHandleImpl::Listen(a_Port, std::move(a_ListenCallbacks));
}
diff --git a/src/OSSupport/TCPLinkImpl.cpp b/src/OSSupport/TCPLinkImpl.cpp
index f1918a76b..c93a1879d 100644
--- a/src/OSSupport/TCPLinkImpl.cpp
+++ b/src/OSSupport/TCPLinkImpl.cpp
@@ -18,7 +18,7 @@
// cTCPLinkImpl:
cTCPLinkImpl::cTCPLinkImpl(cTCPLink::cCallbacksPtr a_LinkCallbacks):
- Super(a_LinkCallbacks),
+ Super(std::move(a_LinkCallbacks)),
m_BufferEvent(bufferevent_socket_new(cNetworkSingleton::Get().GetEventBase(), -1, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE | BEV_OPT_DEFER_CALLBACKS | BEV_OPT_UNLOCK_CALLBACKS)),
m_LocalPort(0),
m_RemotePort(0),
@@ -31,9 +31,9 @@ cTCPLinkImpl::cTCPLinkImpl(cTCPLink::cCallbacksPtr a_LinkCallbacks):
cTCPLinkImpl::cTCPLinkImpl(evutil_socket_t a_Socket, cTCPLink::cCallbacksPtr a_LinkCallbacks, cServerHandleImplPtr a_Server, const sockaddr * a_Address, socklen_t a_AddrLen):
- Super(a_LinkCallbacks),
+ Super(std::move(a_LinkCallbacks)),
m_BufferEvent(bufferevent_socket_new(cNetworkSingleton::Get().GetEventBase(), a_Socket, BEV_OPT_CLOSE_ON_FREE | BEV_OPT_THREADSAFE | BEV_OPT_DEFER_CALLBACKS | BEV_OPT_UNLOCK_CALLBACKS)),
- m_Server(a_Server),
+ m_Server(std::move(a_Server)),
m_LocalPort(0),
m_RemotePort(0),
m_ShouldShutdown(false)
@@ -65,8 +65,8 @@ cTCPLinkImplPtr cTCPLinkImpl::Connect(const AString & a_Host, UInt16 a_Port, cTC
ASSERT(a_ConnectCallbacks != nullptr);
// Create a new link:
- cTCPLinkImplPtr res{new cTCPLinkImpl(a_LinkCallbacks)}; // Cannot use std::make_shared here, constructor is not accessible
- res->m_ConnectCallbacks = a_ConnectCallbacks;
+ cTCPLinkImplPtr res{new cTCPLinkImpl(std::move(a_LinkCallbacks))}; // Cannot use std::make_shared here, constructor is not accessible
+ res->m_ConnectCallbacks = std::move(a_ConnectCallbacks);
cNetworkSingleton::Get().AddLink(res);
res->m_Callbacks->OnLinkCreated(res);
res->Enable(res);
@@ -149,7 +149,7 @@ cTCPLinkImplPtr cTCPLinkImpl::Connect(const AString & a_Host, UInt16 a_Port, cTC
void cTCPLinkImpl::Enable(cTCPLinkImplPtr a_Self)
{
// Take hold of a shared copy of self, to keep as long as the callbacks are coming:
- m_Self = a_Self;
+ m_Self = std::move(a_Self);
// Set the LibEvent callbacks and enable processing:
bufferevent_setcb(m_BufferEvent, ReadCallback, WriteCallback, EventCallback, this);
@@ -550,7 +550,7 @@ cTCPLinkImpl::cLinkTlsContext::cLinkTlsContext(cTCPLinkImpl & a_Link):
void cTCPLinkImpl::cLinkTlsContext::SetSelf(cLinkTlsContextWPtr a_Self)
{
- m_Self = a_Self;
+ m_Self = std::move(a_Self);
}
@@ -700,7 +700,7 @@ bool cNetwork::Connect(
)
{
// Add a connection request to the queue:
- cTCPLinkImplPtr Conn = cTCPLinkImpl::Connect(a_Host, a_Port, a_LinkCallbacks, a_ConnectCallbacks);
+ cTCPLinkImplPtr Conn = cTCPLinkImpl::Connect(a_Host, a_Port, std::move(a_LinkCallbacks), std::move(a_ConnectCallbacks));
return (Conn != nullptr);
}