Close an endpoint and release its resources.
197{
198 {
202 asio::error_code ec;
203
204 if (!it->second->socket.close(ec)) {
206 "Error closing TCP connection {}: {}", endpoint_id, ec.message());
207 }
208
209 if (it->second->reconnect_timer) {
210 it->second->reconnect_timer->cancel();
211 }
213
215 "TCP connection {} closed", endpoint_id);
216 return;
217 }
218 }
219
220 {
224 asio::error_code ec;
225
226 if (it->second->acceptor.close(ec)) {
228 "Error closing TCP listener {}: {}", endpoint_id, ec.message());
229 }
230
232
234 "TCP listener {} closed", endpoint_id);
235 }
236 }
237}
#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.