mutating func receiveChannelClose()

in Sources/NIOSSH/Child Channels/ChildChannelStateMachine.swift [157:183]


    mutating func receiveChannelClose(_ message: SSHMessage.ChannelCloseMessage) throws {
        // We can get channel close at any point after the channel is active.
        switch self.state {
        case .active(channelID: let channelID),
             .halfClosedRemote(channelID: let channelID):
            precondition(message.recipientChannel == channelID.localChannelID)
            self.state = .closedRemotely(channelID: channelID, sentEOF: false)

        case .halfClosedLocal(channelID: let channelID),
             .quiescent(channelID: let channelID):
            precondition(message.recipientChannel == channelID.localChannelID)
            self.state = .closedRemotely(channelID: channelID, sentEOF: true)

        case .closedLocally(channelID: let channelID, receivedPeerEOF: _):
            precondition(message.recipientChannel == channelID.localChannelID)
            self.state = .closed(channelID: channelID)

        case .idle:
            throw NIOSSHError.protocolViolation(protocolName: "channel", violation: "Received close on idle")

        case .requestedLocally, .requestedRemotely:
            throw NIOSSHError.protocolViolation(protocolName: "channel", violation: "Received close before channel was open.")

        case .closedRemotely, .closed:
            throw NIOSSHError.protocolViolation(protocolName: "channel", violation: "Received close on closed channel.")
        }
    }