Skip to content

Conversation

LukeButters
Copy link
Contributor

@LukeButters LukeButters commented Sep 11, 2025

Background

instead it always used the ephemeral one.

When constructing the port forwarder this last paramater:

public PortForwarder(Uri originServer,
            TimeSpan sendDelay,
            Func<BiDirectionalDataTransferObserver> biDirectionalDataTransferObserverFactory,
            int numberOfBytesToDelaySending,
            ILogger logger,
            int? listeningPort = null)

Was not at all used, and instead we always listened on port 0 aka start listening on a free port, even in the case the user set listeningPort to a value.

With this change if you call that ctor with listeningPort = 123 it WILL now listen on port 123.

This is an issue when using the port forwarder ad hoc e.g. in a command line program.

How to review this PR

Quality ✔️

Pre-requisites

  • I have read How we use GitHub Issues for help deciding when and where it's appropriate to make an issue.
  • I have considered informing or consulting the right people, according to the ownership map.
  • I have considered appropriate testing for my change.

@LukeButters LukeButters requested a review from a team as a code owner September 11, 2025 00:07
@LukeButters LukeButters changed the title . Fixes a bug in the PortForwarder in which it would not respect the port to listen on. Sep 11, 2025
Copy link
Contributor

@david-staniec-octopus david-staniec-octopus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@LukeButters LukeButters merged commit 055733e into main Sep 12, 2025
17 checks passed
@LukeButters LukeButters deleted the luke/fix-portforwarder-set-port branch September 12, 2025 04:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants