MCPcopy Index your code
hub / github.com/PatchMon/PatchMon / acceptLoop

Method acceptLoop

server-source-code/internal/rdpproxy/session.go:165–190  ·  view source on GitHub ↗
(ctx context.Context)

Source from the content-addressed store, hash-verified

163}
164
165func (s *Session) acceptLoop(ctx context.Context) {
166 for {
167 conn, err := s.Listener.Accept()
168 if err != nil {
169 if ctx.Err() != nil {
170 return
171 }
172 if s.log != nil {
173 s.log.Debug("rdp proxy accept error", "session_id", s.SessionID, "error", err)
174 }
175 return
176 }
177
178 s.mu.Lock()
179 if s.guacdConn != nil {
180 _ = conn.Close()
181 s.mu.Unlock()
182 continue
183 }
184 s.guacdConn = conn
185 s.mu.Unlock()
186
187 go s.bridgeGuacdToAgent(conn)
188 return
189 }
190}
191
192func (s *Session) bridgeGuacdToAgent(conn net.Conn) {
193 defer func() {

Callers 1

CreateMethod · 0.95

Calls 3

bridgeGuacdToAgentMethod · 0.95
AcceptMethod · 0.80
CloseMethod · 0.45

Tested by

no test coverage detected