Skip to content

Commit 060bee8

Browse files
authored
Assign all member variables in move copy constructor and move assignment operator (#207)
1 parent 026f571 commit 060bee8

File tree

1 file changed

+31
-7
lines changed

1 file changed

+31
-7
lines changed

secure_tunneling/source/SecureTunnel.cpp

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,22 @@ namespace Aws
6262
m_secure_tunnel = aws_secure_tunnel_new(&config);
6363
}
6464

65-
SecureTunnel::SecureTunnel(SecureTunnel &&from) noexcept
65+
SecureTunnel::SecureTunnel(SecureTunnel &&other) noexcept
6666
{
67-
m_secure_tunnel = from.m_secure_tunnel;
68-
from.m_secure_tunnel = nullptr;
67+
m_OnConnectionComplete = other.m_OnConnectionComplete;
68+
m_OnSendDataComplete = other.m_OnSendDataComplete;
69+
m_OnDataReceive = other.m_OnDataReceive;
70+
m_OnStreamStart = other.m_OnStreamStart;
71+
m_OnStreamReset = other.m_OnStreamReset;
72+
m_OnSessionReset = other.m_OnSessionReset;
73+
74+
m_socketOptions = other.m_socketOptions;
75+
m_accessToken = std::move(other.m_accessToken);
76+
m_endpointHost = std::move(other.m_endpointHost);
77+
78+
m_secure_tunnel = other.m_secure_tunnel;
79+
80+
other.m_secure_tunnel = nullptr;
6981
}
7082

7183
SecureTunnel::~SecureTunnel()
@@ -76,14 +88,26 @@ namespace Aws
7688
}
7789
}
7890

79-
SecureTunnel &SecureTunnel::operator=(SecureTunnel &&rhs) noexcept
91+
SecureTunnel &SecureTunnel::operator=(SecureTunnel &&other) noexcept
8092
{
81-
if (this != &rhs)
93+
if (this != &other)
8294
{
8395
this->~SecureTunnel();
8496

85-
m_secure_tunnel = rhs.m_secure_tunnel;
86-
rhs.m_secure_tunnel = nullptr;
97+
m_OnConnectionComplete = other.m_OnConnectionComplete;
98+
m_OnSendDataComplete = other.m_OnSendDataComplete;
99+
m_OnDataReceive = other.m_OnDataReceive;
100+
m_OnStreamStart = other.m_OnStreamStart;
101+
m_OnStreamReset = other.m_OnStreamReset;
102+
m_OnSessionReset = other.m_OnSessionReset;
103+
104+
m_socketOptions = other.m_socketOptions;
105+
m_accessToken = std::move(other.m_accessToken);
106+
m_endpointHost = std::move(other.m_endpointHost);
107+
108+
m_secure_tunnel = other.m_secure_tunnel;
109+
110+
other.m_secure_tunnel = nullptr;
87111
}
88112

89113
return *this;

0 commit comments

Comments
 (0)