From 69a9abd271bbd34909bf34ac126d12bb004384a8 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Mon, 14 Jul 2025 13:22:23 -0400 Subject: [PATCH] MT#62181 tcp_trsp: use deque container Use a container for the actual objects instead of manually managing pointers. Switch from vector to deque as AmThread isn't copy-constructible. No functional changes. Change-Id: I1bbcdcd961319b78612c6fa64dd95fdda8e43d2c --- core/sip/tcp_trsp.cpp | 12 ++++++------ core/sip/tcp_trsp.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/core/sip/tcp_trsp.cpp b/core/sip/tcp_trsp.cpp index 214c6f66..c3562d73 100644 --- a/core/sip/tcp_trsp.cpp +++ b/core/sip/tcp_trsp.cpp @@ -694,22 +694,22 @@ void tcp_server_socket::add_event(struct event_base *evbase) void tcp_server_socket::add_threads(unsigned int n) { for(unsigned int i=0; istart(sd); + workers[i].start(sd); } } void tcp_server_socket::stop_threads() { for(unsigned int i=0; istop(); - workers[i]->join(); + workers[i].stop(); + workers[i].join(); } } @@ -736,7 +736,7 @@ void tcp_server_socket::on_accept(int sd, short ev) // in case of thread pooling, do following in worker thread DBG("tcp_trsp_socket::create_connected (idx = %u)",idx); - tcp_trsp_socket::create_connected(this, *workers[idx], connection_sd, + tcp_trsp_socket::create_connected(this, workers[idx], connection_sd, &src_addr,evbase); } @@ -746,7 +746,7 @@ int tcp_server_socket::send(const sockaddr_storage* sa, const char* msg, uint32_t h = hash_addr(sa); unsigned int idx = h % workers.size(); DBG("tcp_server_socket::send: idx = %u",idx); - return workers[idx]->send(sa,msg,msg_len,flags); + return workers[idx].send(sa, msg, msg_len, flags); } void tcp_server_socket::set_connect_timeout(unsigned int ms) diff --git a/core/sip/tcp_trsp.h b/core/sip/tcp_trsp.h index 57cf6001..15a70557 100644 --- a/core/sip/tcp_trsp.h +++ b/core/sip/tcp_trsp.h @@ -4,8 +4,8 @@ #include "transport.h" #include "sip_parser_async.h" -#include -using std::vector; +#include +using std::deque; /** * Maximum message length for TCP @@ -213,7 +213,7 @@ class tcp_server_socket: public trsp_socket struct event_base* evbase; struct event* ev_accept; - vector workers; + deque workers; /** * Timeout while connecting to a remote peer.