mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-16 00:25:01 +00:00
lib: fix vty.c and smux.c static variable clash
Both vty.c and smux.c declare: static struct thread_master *master This is not a good thing because they are both linked into the same library. If you want to pass different struct thread_master pointers into smux.c and vty.c you will probably not get the result you were looking for Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
1eab5b17bc
commit
79159516d6
11
lib/smux.c
11
lib/smux.c
@ -113,7 +113,7 @@ static struct cmd_node smux_node =
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* thread master */
|
/* thread master */
|
||||||
static struct thread_master *master;
|
static struct thread_master *smux_master;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
oid_compare_part (oid *o1, int o1_len, oid *o2, int o2_len)
|
oid_compare_part (oid *o1, int o1_len, oid *o2, int o2_len)
|
||||||
@ -1239,13 +1239,13 @@ smux_event (enum smux_event event, int sock)
|
|||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case SMUX_SCHEDULE:
|
case SMUX_SCHEDULE:
|
||||||
smux_connect_thread = thread_add_event (master, smux_connect, NULL, 0);
|
smux_connect_thread = thread_add_event (smux_master, smux_connect, NULL, 0);
|
||||||
break;
|
break;
|
||||||
case SMUX_CONNECT:
|
case SMUX_CONNECT:
|
||||||
smux_connect_thread = thread_add_timer (master, smux_connect, NULL, 10);
|
smux_connect_thread = thread_add_timer (smux_master, smux_connect, NULL, 10);
|
||||||
break;
|
break;
|
||||||
case SMUX_READ:
|
case SMUX_READ:
|
||||||
smux_read_thread = thread_add_read (master, smux_read, NULL, sock);
|
smux_read_thread = thread_add_read (smux_master, smux_read, NULL, sock);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1473,8 +1473,9 @@ smux_tree_cmp(struct subtree *tree1, struct subtree *tree2)
|
|||||||
void
|
void
|
||||||
smux_init (struct thread_master *tm)
|
smux_init (struct thread_master *tm)
|
||||||
{
|
{
|
||||||
|
assert (tm);
|
||||||
/* copy callers thread master */
|
/* copy callers thread master */
|
||||||
master = tm;
|
smux_master = tm;
|
||||||
|
|
||||||
/* Make MIB tree. */
|
/* Make MIB tree. */
|
||||||
treelist = list_new();
|
treelist = list_new();
|
||||||
|
20
lib/vty.c
20
lib/vty.c
@ -2527,7 +2527,7 @@ vty_config_unlock (struct vty *vty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Master of the threads. */
|
/* Master of the threads. */
|
||||||
static struct thread_master *master;
|
static struct thread_master *vty_master;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vty_event (enum event event, int sock, struct vty *vty)
|
vty_event (enum event event, int sock, struct vty *vty)
|
||||||
@ -2537,23 +2537,23 @@ vty_event (enum event event, int sock, struct vty *vty)
|
|||||||
switch (event)
|
switch (event)
|
||||||
{
|
{
|
||||||
case VTY_SERV:
|
case VTY_SERV:
|
||||||
vty_serv_thread = thread_add_read (master, vty_accept, vty, sock);
|
vty_serv_thread = thread_add_read (vty_master, vty_accept, vty, sock);
|
||||||
vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
|
vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
|
||||||
break;
|
break;
|
||||||
#ifdef VTYSH
|
#ifdef VTYSH
|
||||||
case VTYSH_SERV:
|
case VTYSH_SERV:
|
||||||
vty_serv_thread = thread_add_read (master, vtysh_accept, vty, sock);
|
vty_serv_thread = thread_add_read (vty_master, vtysh_accept, vty, sock);
|
||||||
vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
|
vector_set_index (Vvty_serv_thread, sock, vty_serv_thread);
|
||||||
break;
|
break;
|
||||||
case VTYSH_READ:
|
case VTYSH_READ:
|
||||||
vty->t_read = thread_add_read (master, vtysh_read, vty, sock);
|
vty->t_read = thread_add_read (vty_master, vtysh_read, vty, sock);
|
||||||
break;
|
break;
|
||||||
case VTYSH_WRITE:
|
case VTYSH_WRITE:
|
||||||
vty->t_write = thread_add_write (master, vtysh_write, vty, sock);
|
vty->t_write = thread_add_write (vty_master, vtysh_write, vty, sock);
|
||||||
break;
|
break;
|
||||||
#endif /* VTYSH */
|
#endif /* VTYSH */
|
||||||
case VTY_READ:
|
case VTY_READ:
|
||||||
vty->t_read = thread_add_read (master, vty_read, vty, sock);
|
vty->t_read = thread_add_read (vty_master, vty_read, vty, sock);
|
||||||
|
|
||||||
/* Time out treatment. */
|
/* Time out treatment. */
|
||||||
if (vty->v_timeout)
|
if (vty->v_timeout)
|
||||||
@ -2561,12 +2561,12 @@ vty_event (enum event event, int sock, struct vty *vty)
|
|||||||
if (vty->t_timeout)
|
if (vty->t_timeout)
|
||||||
thread_cancel (vty->t_timeout);
|
thread_cancel (vty->t_timeout);
|
||||||
vty->t_timeout =
|
vty->t_timeout =
|
||||||
thread_add_timer (master, vty_timeout, vty, vty->v_timeout);
|
thread_add_timer (vty_master, vty_timeout, vty, vty->v_timeout);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VTY_WRITE:
|
case VTY_WRITE:
|
||||||
if (! vty->t_write)
|
if (! vty->t_write)
|
||||||
vty->t_write = thread_add_write (master, vty_flush, vty, sock);
|
vty->t_write = thread_add_write (vty_master, vty_flush, vty, sock);
|
||||||
break;
|
break;
|
||||||
case VTY_TIMEOUT_RESET:
|
case VTY_TIMEOUT_RESET:
|
||||||
if (vty->t_timeout)
|
if (vty->t_timeout)
|
||||||
@ -2577,7 +2577,7 @@ vty_event (enum event event, int sock, struct vty *vty)
|
|||||||
if (vty->v_timeout)
|
if (vty->v_timeout)
|
||||||
{
|
{
|
||||||
vty->t_timeout =
|
vty->t_timeout =
|
||||||
thread_add_timer (master, vty_timeout, vty, vty->v_timeout);
|
thread_add_timer (vty_master, vty_timeout, vty, vty->v_timeout);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3002,7 +3002,7 @@ vty_init (struct thread_master *master_thread)
|
|||||||
|
|
||||||
vtyvec = vector_init (VECTOR_MIN_SIZE);
|
vtyvec = vector_init (VECTOR_MIN_SIZE);
|
||||||
|
|
||||||
master = master_thread;
|
vty_master = master_thread;
|
||||||
|
|
||||||
/* Initilize server thread vector. */
|
/* Initilize server thread vector. */
|
||||||
Vvty_serv_thread = vector_init (VECTOR_MIN_SIZE);
|
Vvty_serv_thread = vector_init (VECTOR_MIN_SIZE);
|
||||||
|
Loading…
Reference in New Issue
Block a user