Accept named-pipe agent connections, carry the remote peer through the agent handshake, and treat pipe disconnects as probes

This commit is contained in:
Viktor Liu
2026-09-23 14:03:59 +02:00
parent b9264d2824
commit c26b17653a
10 changed files with 245 additions and 57 deletions
+4 -6
View File
@@ -183,8 +183,6 @@ type fbRequest struct {
incremental bool
}
func (s *session) addr() string { return s.conn.RemoteAddr().String() }
// lockWrite takes writeMu and arms the write deadline for the writes that
// follow, returning the unlock. Every server-to-client write goes through it,
// so no write can outlive writeDeadline.
@@ -205,10 +203,10 @@ func (s *session) serve() {
s.encodeCh = make(chan fbRequest, 1)
if err := s.handshake(); err != nil {
s.log.Warnf("handshake with %s: %v", s.addr(), err)
s.log.Warnf("RFB handshake: %v", err)
return
}
s.log.Infof("client connected: %s", s.addr())
s.log.Info("client connected")
// View-only clients can't move the pointer, so default to compositing
// the host cursor into the framebuffer. The client can still send
@@ -246,9 +244,9 @@ func (s *session) serve() {
// messageLoop only ever returns an error, so the interesting question is
// which one: a clean client disconnect is io.EOF and not worth a warning.
if err := s.messageLoop(); !errors.Is(err, io.EOF) {
s.log.Warnf("client %s disconnected: %v", s.addr(), err)
s.log.Warnf("client disconnected: %v", err)
} else {
s.log.Infof("client disconnected: %s", s.addr())
s.log.Info("client disconnected")
}
}