0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-20 12:02:28 +02:00

Remove thread_mode field of multi_context

This is leftover of a never functional multi threaded openvpn
implementation attempt. It serves no purposes anymore.

Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20210401131337.3684-11-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg21952.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Arne Schwabe 2021-04-01 15:13:33 +02:00 committed by Gert Doering
parent aba8776e67
commit 18b4a8380b
4 changed files with 31 additions and 50 deletions

View File

@ -789,7 +789,7 @@ tunnel_server_tcp(struct context *top)
} }
/* initialize global multi_context object */ /* initialize global multi_context object */
multi_init(&multi, top, true, MC_SINGLE_THREADED); multi_init(&multi, top, true);
/* initialize our cloned top object */ /* initialize our cloned top object */
multi_top_init(&multi, top); multi_top_init(&multi, top);

View File

@ -300,7 +300,7 @@ tunnel_server_udp(struct context *top)
} }
/* initialize global multi_context object */ /* initialize global multi_context object */
multi_init(&multi, top, false, MC_SINGLE_THREADED); multi_init(&multi, top, false);
/* initialize our cloned top object */ /* initialize our cloned top object */
multi_top_init(&multi, top); multi_top_init(&multi, top);

View File

@ -290,7 +290,7 @@ int_compare_function(const void *key1, const void *key2)
* Main initialization function, init multi_context object. * Main initialization function, init multi_context object.
*/ */
void void
multi_init(struct multi_context *m, struct context *t, bool tcp_mode, int thread_mode) multi_init(struct multi_context *m, struct context *t, bool tcp_mode)
{ {
int dev = DEV_TYPE_UNDEF; int dev = DEV_TYPE_UNDEF;
@ -308,8 +308,6 @@ multi_init(struct multi_context *m, struct context *t, bool tcp_mode, int thread
*/ */
CLEAR(*m); CLEAR(*m);
m->thread_mode = thread_mode;
/* /*
* Real address hash table (source port number is * Real address hash table (source port number is
* considered to be part of the address). Used * considered to be part of the address). Used
@ -703,53 +701,44 @@ multi_close_instance(struct multi_context *m,
void void
multi_uninit(struct multi_context *m) multi_uninit(struct multi_context *m)
{ {
if (m->thread_mode & MC_WORK_THREAD) if (m->hash)
{ {
multi_top_free(m); struct hash_iterator hi;
m->thread_mode = MC_UNDEF; struct hash_element *he;
}
else if (m->thread_mode) hash_iterator_init(m->iter, &hi);
{ while ((he = hash_iterator_next(&hi)))
if (m->hash)
{ {
struct hash_iterator hi; struct multi_instance *mi = (struct multi_instance *) he->value;
struct hash_element *he; mi->did_iter = false;
multi_close_instance(m, mi, true);
}
hash_iterator_free(&hi);
hash_iterator_init(m->iter, &hi); multi_reap_all(m);
while ((he = hash_iterator_next(&hi)))
{
struct multi_instance *mi = (struct multi_instance *) he->value;
mi->did_iter = false;
multi_close_instance(m, mi, true);
}
hash_iterator_free(&hi);
multi_reap_all(m); hash_free(m->hash);
hash_free(m->vhash);
hash_free(m->hash); hash_free(m->iter);
hash_free(m->vhash);
hash_free(m->iter);
#ifdef ENABLE_MANAGEMENT #ifdef ENABLE_MANAGEMENT
hash_free(m->cid_hash); hash_free(m->cid_hash);
#endif #endif
m->hash = NULL; m->hash = NULL;
free(m->instances); free(m->instances);
#ifdef ENABLE_ASYNC_PUSH #ifdef ENABLE_ASYNC_PUSH
hash_free(m->inotify_watchers); hash_free(m->inotify_watchers);
m->inotify_watchers = NULL; m->inotify_watchers = NULL;
#endif #endif
schedule_free(m->schedule); schedule_free(m->schedule);
mbuf_free(m->mbuf); mbuf_free(m->mbuf);
ifconfig_pool_free(m->ifconfig_pool); ifconfig_pool_free(m->ifconfig_pool);
frequency_limit_free(m->new_connection_limiter); frequency_limit_free(m->new_connection_limiter);
multi_reap_free(m->reaper); multi_reap_free(m->reaper);
mroute_helper_free(m->route_helper); mroute_helper_free(m->route_helper);
multi_tcp_free(m->mtcp); multi_tcp_free(m->mtcp);
m->thread_mode = MC_UNDEF;
}
} }
} }

View File

@ -150,14 +150,6 @@ struct multi_instance {
* server-mode. * server-mode.
*/ */
struct multi_context { struct multi_context {
#define MC_UNDEF 0
#define MC_SINGLE_THREADED (1<<0)
#define MC_MULTI_THREADED_MASTER (1<<1)
#define MC_MULTI_THREADED_WORKER (1<<2)
#define MC_MULTI_THREADED_SCHEDULER (1<<3)
#define MC_WORK_THREAD (MC_MULTI_THREADED_WORKER|MC_MULTI_THREADED_SCHEDULER)
int thread_mode;
struct multi_instance **instances; /**< Array of multi_instances. An instance can be struct multi_instance **instances; /**< Array of multi_instances. An instance can be
* accessed using peer-id as an index. */ * accessed using peer-id as an index. */
@ -261,7 +253,7 @@ const char *multi_instance_string(const struct multi_instance *mi, bool null, st
* Called by mtcp.c, mudp.c, or other (to be written) protocol drivers * Called by mtcp.c, mudp.c, or other (to be written) protocol drivers
*/ */
void multi_init(struct multi_context *m, struct context *t, bool tcp_mode, int thread_mode); void multi_init(struct multi_context *m, struct context *t, bool tcp_mode);
void multi_uninit(struct multi_context *m); void multi_uninit(struct multi_context *m);