MCPcopy
hub / github.com/nats-io/nats.go / currentServer

Method currentServer

nats.go:1932–1942  ·  view source on GitHub ↗

Return the currently selected server

()

Source from the content-addressed store, hash-verified

1930
1931// Return the currently selected server
1932func (nc *Conn) currentServer() (int, *Server) {
1933 for i, s := range nc.srvPool {
1934 if s == nil {
1935 continue
1936 }
1937 if s == nc.current {
1938 return i, s
1939 }
1940 }
1941 return -1, nil
1942}
1943
1944// Pop the current server and put onto the end of the list. Select head of list as long
1945// as number of reconnect attempts under MaxReconnect.

Callers 2

selectNextServerMethod · 0.95
createConnMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected