pkat = pkat_new(peer);
listnode_add(peerlist, pkat);
peer_lock(peer);
+ SET_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON);
}
pthread_mutex_unlock(&peerlist_mtx);
peer_keepalives_wake();
list_delete_node(peerlist, ln);
peer_unlock(peer);
}
+
+ UNSET_FLAG(peer->thread_flags, PEER_THREAD_KEEPALIVES_ON);
}
pthread_mutex_unlock(&peerlist_mtx);
}
peer_lock(peer);
listnode_add(plist, peer);
+
+ SET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON);
}
pthread_mutex_unlock(&plist_mtx);
peer_writes_wake();
peer_unlock(peer);
break;
}
+
+ UNSET_FLAG(peer->thread_flags, PEER_THREAD_WRITES_ON);
}
pthread_mutex_unlock(&plist_mtx);
}
json_object_string_add(json_neigh, "readThread", "on");
else
json_object_string_add(json_neigh, "readThread", "off");
- if (p->t_write)
+
+ if (CHECK_FLAG(p->thread_flags, PEER_THREAD_WRITES_ON))
json_object_string_add(json_neigh, "writeThread", "on");
else
json_object_string_add(json_neigh, "writeThread",
vty_out(vty, "Peer Authentication Enabled\n");
vty_out(vty, "Read thread: %s Write thread: %s\n",
- p->t_read ? "on" : "off", p->t_write ? "on" : "off");
+ p->t_read ? "on" : "off",
+ CHECK_FLAG(p->thread_flags, PEER_THREAD_WRITES_ON)
+ ? "on"
+ : "off");
}
if (p->notify.code == BGP_NOTIFY_OPEN_ERR
/* Threads. */
struct thread *t_read;
- struct thread *t_write;
struct thread *t_start;
struct thread *t_connect;
struct thread *t_holdtime;
- struct thread *t_keepalive;
struct thread *t_routeadv;
struct thread *t_pmax_restart;
struct thread *t_gr_restart;
struct thread *t_gr_stale;
+ /* Thread flags. */
+ u_int16_t thread_flags;
+#define PEER_THREAD_WRITES_ON (1 << 0)
+#define PEER_THREAD_KEEPALIVES_ON (1 << 1)
/* workqueues */
struct work_queue *clear_node_queue;