MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / handleBackend

Method handleBackend

agentprotocol/server.go:364–402  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

362}
363
364func (c *ForwardCtx) handleBackend() {
365 for {
366 packet := Packet{}
367 err := c.decoder.Decode(&packet)
368 if err != nil {
369 c.logger.Error(message.Wrap(
370 err,
371 message.MSSHConnected,
372 "Error decoding packet from backend",
373 ))
374 return
375 }
376 switch packet.Type {
377 case PACKET_DATA:
378 c.handleData(&packet)
379 case PACKET_CLOSE_CONNECTION:
380 c.handleClose(&packet)
381 case PACKET_SUCCESS:
382 c.handleSuccess(&packet)
383 case PACKET_ERROR:
384 c.handleError(&packet)
385 case PACKET_NEW_CONNECTION:
386 c.handleNewConnection(&packet)
387 case PACKET_NO_MORE_CONNECTIONS:
388 if !c.stopped {
389 c.stopped = true
390 close(c.connectionChannel)
391 }
392 default:
393 c.logger.Warning(
394 message.NewMessage(
395 message.EAgentUnknownPacket,
396 "Received unknown packet type %d from agent",
397 packet.Type,
398 ),
399 )
400 }
401 }
402}
403
404func (c *ForwardCtx) unmarshalSetup(payload []byte) (SetupPacket, error) {
405 packet := SetupPacket{}

Callers 3

StartClientMethod · 0.95
StartServerForwardMethod · 0.95

Calls 10

handleDataMethod · 0.95
handleCloseMethod · 0.95
handleSuccessMethod · 0.95
handleErrorMethod · 0.95
handleNewConnectionMethod · 0.95
WrapFunction · 0.92
NewMessageFunction · 0.92
DecodeMethod · 0.65
ErrorMethod · 0.65
WarningMethod · 0.65

Tested by

no test coverage detected