MCPcopy
hub / github.com/ContainerSSH/ContainerSSH / Accept

Method Accept

agentprotocol/server.go:119–135  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

117}
118
119func (c *Connection) Accept() error {
120 c.lock.Lock()
121 defer c.lock.Unlock()
122 if c.initiator {
123 return fmt.Errorf("cannot accept connection that was initiated locally")
124 }
125 if c.state != CONNECTION_STATE_WAITINIT {
126 return fmt.Errorf("invalid state, cannot accept connection in state %d", c.state)
127 }
128 c.state = CONNECTION_STATE_STARTED
129 c.stateCond.Broadcast()
130 packet := Packet{
131 Type: PACKET_SUCCESS,
132 ConnectionId: c.id,
133 }
134 return c.ctx.writePacket(&packet)
135}
136
137func (c *Connection) Reject() error {
138 c.lock.Lock()

Callers 11

TestConnectionSetupFunction · 0.80
RunWithLifecycleMethod · 0.80
handleSessionChannelMethod · 0.80
handleX11ChannelMethod · 0.80
serveX11Method · 0.80
serveReverseForwardMethod · 0.80

Calls 2

writePacketMethod · 0.80
ErrorfMethod · 0.65

Tested by 1

TestConnectionSetupFunction · 0.64