Automatically close GTP sockets at program end
This commit is contained in:
@@ -142,6 +142,12 @@ class gtpEndPoints {
|
|||||||
pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER;
|
pthread_mutex_t gtp_lock=PTHREAD_MUTEX_INITIALIZER;
|
||||||
// the instance id will be the Linux socket handler, as this is uniq
|
// the instance id will be the Linux socket handler, as this is uniq
|
||||||
map<int, gtpEndPoint> instances;
|
map<int, gtpEndPoint> instances;
|
||||||
|
|
||||||
|
~gtpEndPoints() {
|
||||||
|
// automatically close all sockets on quit
|
||||||
|
for (const auto p : instances)
|
||||||
|
close(p.first);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
gtpEndPoints globGtp;
|
gtpEndPoints globGtp;
|
||||||
|
|||||||
Reference in New Issue
Block a user