Close an endpoint and release its resources.
193{
194 {
198 asio::error_code ec;
199
200 if (!it->second->socket.close(ec)) {
202 "Error closing TCP connection {}: {}", endpoint_id, ec.message());
203 }
204
205 if (it->second->reconnect_timer) {
206 it->second->reconnect_timer->cancel();
207 }
209
211 "TCP connection {} closed", endpoint_id);
212 return;
213 }
214 }
215
216 {
220 asio::error_code ec;
221
222 if (it->second->acceptor.close(ec)) {
224 "Error closing TCP listener {}: {}", endpoint_id, ec.message());
225 }
226
228
230 "TCP listener {} closed", endpoint_id);
231 }
232 }
233}
#define MF_WARN(comp, ctx,...)
#define MF_DEBUG(comp, ctx,...)
std::unordered_map< uint64_t, std::unique_ptr< ConnectionState > > m_connections
std::shared_mutex m_listeners_mutex
std::unordered_map< uint64_t, std::unique_ptr< ListenerState > > m_listeners
std::shared_mutex m_connections_mutex
@ NetworkBackend
Network transport backend (UDP, TCP, SHM)
@ Core
Core engine, backend, subsystems.