Automatically close GTP sockets at program end

This commit is contained in:
Robert Schmidt
2022-08-16 14:44:22 +02:00
parent 19d83ad21e
commit 1df60139e2
+6
View File
@@ -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;