MCPcopy
hub / github.com/PatchMon/PatchMon / SendToAgent

Method SendToAgent

server-source-code/internal/rdpproxy/session.go:155–163  ·  view source on GitHub ↗

SendToAgent sends a message to the agent owning the named session. Writes are serialised by the registry's per-agent write mutex.

(sessionID string, msg any)

Source from the content-addressed store, hash-verified

153// SendToAgent sends a message to the agent owning the named session. Writes
154// are serialised by the registry's per-agent write mutex.
155func (s *Sessions) SendToAgent(sessionID string, msg any) error {
156 s.mu.RLock()
157 sess, ok := s.sessions[sessionID]
158 s.mu.RUnlock()
159 if !ok {
160 return errors.New("session not found")
161 }
162 return sess.sender.SendJSON(sess.ApiID, msg)
163}
164
165func (s *Session) acceptLoop(ctx context.Context) {
166 for {

Callers 1

ServeCreateTicketMethod · 0.80

Calls 1

SendJSONMethod · 0.65

Tested by

no test coverage detected