cancelForwardRemote method

Future<bool> cancelForwardRemote(
  1. SSHRemoteForward forward
)

Cancel a previous request to forward connections to a port on the other side. Returns true if successful, false otherwise. See also: forwardRemote.

Implementation

Future<bool> cancelForwardRemote(SSHRemoteForward forward) async {
  await _authenticated.future;

  if (!_remoteForwards.remove(forward)) return false;

  _sendMessage(
    SSH_Message_Global_Request.cancelTcpipForward(
      bindAddress: forward.host,
      bindPort: forward.port,
    ),
  );

  final reply = await _globalRequestReplyQueue.next;
  if (reply is SSH_Message_Request_Failure) {
    return false;
  }

  return true;
}