Skip to content

Commit

Permalink
Don't require TLS for in-process connection
Browse files Browse the repository at this point in the history
Signed-off-by: Neil Twigg <neil@nats.io>
  • Loading branch information
neilalexander committed Jul 19, 2023
1 parent 80fb29f commit 9f6320d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions server/client_test.go
Expand Up @@ -85,7 +85,7 @@ func createClientAsync(ch chan *client, s *Server, cli net.Conn) {
s.grWG.Add(1)
}
go func() {
c := s.createClient(cli)
c := s.createClient(cli, false)
// Must be here to suppress +OK
c.opts.Verbose = false
if startWriteLoop {
Expand Down Expand Up @@ -2270,7 +2270,7 @@ func TestCloseConnectionVeryEarly(t *testing.T) {
// Call again with this closed connection. Alternatively, we
// would have to call with a fake connection that implements
// net.Conn but returns an error on Write.
s.createClient(c)
s.createClient(c, false)

// This connection should not have been added to the server.
checkClientsCount(t, s, 0)
Expand Down
8 changes: 4 additions & 4 deletions server/server.go
Expand Up @@ -2192,7 +2192,7 @@ func (s *Server) AcceptLoop(clr chan struct{}) {
s.clientConnectURLs = s.getClientConnectURLs()
s.listener = l

go s.acceptConnections(l, "Client", func(conn net.Conn) { s.createClient(conn) },
go s.acceptConnections(l, "Client", func(conn net.Conn) { s.createClient(conn, false) },
func(_ error) bool {
if s.isLameDuckMode() {
// Signal that we are not accepting new clients
Expand All @@ -2217,7 +2217,7 @@ func (s *Server) AcceptLoop(clr chan struct{}) {
func (s *Server) InProcessConn() (net.Conn, error) {
pl, pr := net.Pipe()
if !s.startGoRoutine(func() {
s.createClient(pl)
s.createClient(pl, true)
s.grWG.Done()
}) {
pl.Close()
Expand Down Expand Up @@ -2571,7 +2571,7 @@ func (c *tlsMixConn) Read(b []byte) (int, error) {
return c.Conn.Read(b)
}

func (s *Server) createClient(conn net.Conn) *client {
func (s *Server) createClient(conn net.Conn, inProcess bool) *client {
// Snapshot server options.
opts := s.getOpts()

Expand Down Expand Up @@ -2659,7 +2659,7 @@ func (s *Server) createClient(conn net.Conn) *client {
}
s.clients[c.cid] = c

tlsRequired := info.TLSRequired
tlsRequired := info.TLSRequired && !inProcess
s.mu.Unlock()

// Re-Grab lock
Expand Down

0 comments on commit 9f6320d

Please sign in to comment.