Skip to content

Commit

Permalink
Merge pull request #373 from aws/dev
Browse files Browse the repository at this point in the history
chore: release 0.25
  • Loading branch information
ganeshnj authored Oct 14, 2021
2 parents b1baf24 + f0fd8d3 commit fcbdfc0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/AWS.Deploy.ServerMode.Client/ServerModeSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Net.NetworkInformation;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
Expand Down Expand Up @@ -126,6 +127,14 @@ public async Task Start(CancellationToken cancellationToken)

for (var port = _startPort; port <= _endPort; port++)
{
// This ensures that deploy tool CLI doesn't try on the in-use port
// because server availability task will return success response for
// an in-use port
if (IsPortInUse(port))
{
continue;
}

_aes = Aes.Create();
_aes.GenerateKey();

Expand Down Expand Up @@ -216,6 +225,14 @@ private Task<bool> IsServerAvailable(CancellationToken cancellationToken)
cancellationToken);
}

private static bool IsPortInUse(int port)
{
var ipGlobalProperties = IPGlobalProperties.GetIPGlobalProperties();
var listeners = ipGlobalProperties.GetActiveTcpListeners();

return listeners.Any(x => x.Port == port);
}

#endregion

#region Disposable
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "0.24",
"version": "0.25",
"publicReleaseRefSpec": [
".*"
],
Expand Down

0 comments on commit fcbdfc0

Please sign in to comment.