(ctx context.Context)
| 163 | } |
| 164 | |
| 165 | func (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 | |
| 192 | func (s *Session) bridgeGuacdToAgent(conn net.Conn) { |
| 193 | defer func() { |
no test coverage detected