MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / handleClose

Method handleClose

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

Source from the content-addressed store, hash-verified

233}
234
235func (c *ForwardCtx) handleClose(packet *Packet) {
236 c.connMapMu.Lock()
237 conn, ok := c.connMap[packet.ConnectionId]
238 if !ok {
239 c.logger.Info(
240 message.NewMessage(
241 message.EAgentUnknownConnection,
242 "Received close packet with unknown connection id %d",
243 packet.ConnectionId,
244 ),
245 )
246 return
247 }
248 c.connMapMu.Unlock()
249 err := conn.CloseImm()
250 retPacket := Packet{
251 Type: PACKET_SUCCESS,
252 ConnectionId: conn.id,
253 }
254 if err != nil {
255 retPacket.Type = PACKET_ERROR
256 }
257 _ = c.writePacket(&retPacket)
258}
259
260func (c *ForwardCtx) handleSuccess(packet *Packet) {
261 c.connMapMu.Lock()

Callers 1

handleBackendMethod · 0.95

Calls 4

writePacketMethod · 0.95
NewMessageFunction · 0.92
CloseImmMethod · 0.80
InfoMethod · 0.65

Tested by

no test coverage detected