MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / handleSuccess

Method handleSuccess

agentprotocol/server.go:260–288  ·  view source on GitHub ↗
(packet *Packet)

Source from the content-addressed store, hash-verified

258}
259
260func (c *ForwardCtx) handleSuccess(packet *Packet) {
261 c.connMapMu.Lock()
262 defer c.connMapMu.Unlock()
263 conn, ok := c.connMap[packet.ConnectionId]
264 if !ok {
265 c.logger.Info(
266 message.NewMessage(
267 message.EAgentUnknownConnection,
268 "Received success packet with unknown connection id %d",
269 packet.ConnectionId,
270 ),
271 )
272 return
273 }
274
275 switch conn.state {
276 case CONNECTION_STATE_WAITINIT:
277 conn.setState(CONNECTION_STATE_STARTED)
278 case CONNECTION_STATE_WAITCLOSE:
279 _ = conn.CloseImm()
280 default:
281 c.logger.Warning(
282 message.NewMessage(
283 message.EAgentConnectionInvalidState,
284 "Received success packet for agent connection in non-wait state",
285 ),
286 )
287 }
288}
289
290func (c *ForwardCtx) handleError(packet *Packet) {
291 c.connMapMu.Lock()

Callers 1

handleBackendMethod · 0.95

Calls 5

NewMessageFunction · 0.92
setStateMethod · 0.80
CloseImmMethod · 0.80
InfoMethod · 0.65
WarningMethod · 0.65

Tested by

no test coverage detected