mirror of
https://github.com/golang/go
synced 2024-11-18 09:24:54 -07:00
internal/lsp/lsprpc: quiet the handshaker during regtests
There's a bunch of noise in regtest results related to the LSP forwarder handshake. lsprpc.StreamServer was already configurable to disable connection logging in tests. Use this configuration to also disable handshake logging. Change-Id: I4b00e23d1f0bc6dc5fdd1f6f470f0b892c6791bc Reviewed-on: https://go-review.googlesource.com/c/tools/+/249418 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
parent
ed71c57206
commit
c886c0b611
@ -77,7 +77,7 @@ func (s *StreamServer) ServeStream(ctx context.Context, conn jsonrpc2.Conn) erro
|
|||||||
ctx = protocol.WithClient(ctx, client)
|
ctx = protocol.WithClient(ctx, client)
|
||||||
conn.Go(ctx,
|
conn.Go(ctx,
|
||||||
protocol.Handlers(
|
protocol.Handlers(
|
||||||
handshaker(session, executable,
|
handshaker(session, executable, s.logConnections,
|
||||||
protocol.ServerHandler(server,
|
protocol.ServerHandler(server,
|
||||||
jsonrpc2.MethodNotFound))))
|
jsonrpc2.MethodNotFound))))
|
||||||
if s.logConnections {
|
if s.logConnections {
|
||||||
@ -497,7 +497,7 @@ const (
|
|||||||
sessionsMethod = "gopls/sessions"
|
sessionsMethod = "gopls/sessions"
|
||||||
)
|
)
|
||||||
|
|
||||||
func handshaker(session *cache.Session, goplsPath string, handler jsonrpc2.Handler) jsonrpc2.Handler {
|
func handshaker(session *cache.Session, goplsPath string, logHandshakes bool, handler jsonrpc2.Handler) jsonrpc2.Handler {
|
||||||
return func(ctx context.Context, reply jsonrpc2.Replier, r jsonrpc2.Request) error {
|
return func(ctx context.Context, reply jsonrpc2.Replier, r jsonrpc2.Request) error {
|
||||||
switch r.Method() {
|
switch r.Method() {
|
||||||
case handshakeMethod:
|
case handshakeMethod:
|
||||||
@ -506,11 +506,15 @@ func handshaker(session *cache.Session, goplsPath string, handler jsonrpc2.Handl
|
|||||||
// client.
|
// client.
|
||||||
var req handshakeRequest
|
var req handshakeRequest
|
||||||
if err := json.Unmarshal(r.Params(), &req); err != nil {
|
if err := json.Unmarshal(r.Params(), &req); err != nil {
|
||||||
log.Printf("Error processing handshake for session %s: %v", session.ID(), err)
|
if logHandshakes {
|
||||||
|
log.Printf("Error processing handshake for session %s: %v", session.ID(), err)
|
||||||
|
}
|
||||||
sendError(ctx, reply, err)
|
sendError(ctx, reply, err)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
log.Printf("Session %s: got handshake. Logfile: %q, Debug addr: %q", session.ID(), req.Logfile, req.DebugAddr)
|
if logHandshakes {
|
||||||
|
log.Printf("Session %s: got handshake. Logfile: %q, Debug addr: %q", session.ID(), req.Logfile, req.DebugAddr)
|
||||||
|
}
|
||||||
event.Log(ctx, "Handshake session update",
|
event.Log(ctx, "Handshake session update",
|
||||||
cache.KeyUpdateSession.Of(session),
|
cache.KeyUpdateSession.Of(session),
|
||||||
tag.DebugAddress.Of(req.DebugAddr),
|
tag.DebugAddress.Of(req.DebugAddr),
|
||||||
|
Loading…
Reference in New Issue
Block a user