MT#59962 tcp_trsp: move new sock to connections map

Instead of copying, move that.
And then later for the local socket assignment
operations use a copy connections map member used
as a destination shortly before.

Closes Coverity CID 642750.

Change-Id: Ief7891c1962251b33cd5960e74e4081685881dcf
mr14.1
Donat Zenichev 7 months ago
parent a3539106e8
commit 82570bbd63

@ -536,9 +536,9 @@ int tcp_server_worker::send(const sockaddr_storage* sa, const char* msg,
else {
//TODO: add flags to avoid new connections (ex: UAs behind NAT)
auto new_sock = tcp_trsp_socket::new_connection(server_sock, *this, sa, evbase);
connections[dest] = new_sock;
connections[dest] = new_sock; // copy
sock = new_sock;
sock = std::move(new_sock);
new_conn = true;
}
connections_mut.unlock();

Loading…
Cancel
Save