Merge branch 'main' into dev

This commit is contained in:
Derek Collison
2023-04-14 16:44:25 -07:00
2 changed files with 6 additions and 1 deletions

View File

@@ -740,6 +740,7 @@ func (s *Server) HandleConnz(w http.ResponseWriter, r *http.Request) {
// Routez represents detailed information on current client connections.
type Routez struct {
ID string `json:"server_id"`
Name string `json:"server_name"`
Now time.Time `json:"now"`
Import *SubjectPermission `json:"import,omitempty"`
Export *SubjectPermission `json:"export,omitempty"`
@@ -759,6 +760,7 @@ type RoutezOptions struct {
type RouteInfo struct {
Rid uint64 `json:"rid"`
RemoteID string `json:"remote_id"`
RemoteName string `json:"remote_name"`
DidSolicit bool `json:"did_solicit"`
IsConfigured bool `json:"is_configured"`
IP string `json:"ip"`
@@ -801,12 +803,14 @@ func (s *Server) Routez(routezOpts *RoutezOptions) (*Routez, error) {
rs.Import = perms.Import
rs.Export = perms.Export
}
rs.Name = s.getOpts().ServerName
addRoute := func(r *client) {
r.mu.Lock()
ri := &RouteInfo{
Rid: r.cid,
RemoteID: r.route.remoteID,
RemoteName: r.route.remoteName,
DidSolicit: r.route.didSolicit,
IsConfigured: r.route.routeType == Explicit,
InMsgs: atomic.LoadInt64(&r.inMsgs),

View File

@@ -2927,7 +2927,8 @@ func (n *raft) processAppendEntry(ae *appendEntry, sub *subscription) {
// Are we receiving from another leader.
if n.state == Leader {
if ae.term > n.term {
// If we are the same we should step down to break the tie.
if ae.term >= n.term {
n.term = ae.term
n.vote = noVote
n.writeTermVote()