diff --git a/openair3/ocp-gtpu/gtp_itf.cpp b/openair3/ocp-gtpu/gtp_itf.cpp index dc93960e5e3e7bcd606f1769c599fc8075ae0ed1..afef8ea4357ed5ea291d7a635ae6b26f0f363b8a 100644 --- a/openair3/ocp-gtpu/gtp_itf.cpp +++ b/openair3/ocp-gtpu/gtp_itf.cpp @@ -142,6 +142,12 @@ class gtpEndPoints { pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER; // the instance id will be the Linux socket handler, as this is uniq map<int, gtpEndPoint> instances; + + ~gtpEndPoints() { + // automatically close all sockets on quit + for (const auto p : instances) + close(p.first); + } }; gtpEndPoints globGtp;