Skip to content

Commit

Permalink
Fixes #272
Browse files Browse the repository at this point in the history
On my system I found that 4 seconds was not logn enough for DHT to start.
Time for a new computer perhaps...

Anyway I have bumped the timeout to 10 seconds (FYI: my system on average took
6 seconds to start DHT).

I have also added in a check to see if the timeout has indeed been reached.
  • Loading branch information
brad-jones committed Jul 22, 2015
1 parent 73b47c5 commit 3bf3018
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/OmniSharp/Dnx/DesignTimeHostManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void Start(string hostId, Action<int> onConnected)
using (var socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp))
{
var t1 = DateTime.UtcNow;
var dthTimeout = TimeSpan.FromSeconds(4);
var dthTimeout = TimeSpan.FromSeconds(10);
while (!socket.Connected && DateTime.UtcNow - t1 < dthTimeout)
{
Thread.Sleep(500);
Expand All @@ -76,6 +76,13 @@ public void Start(string hostId, Action<int> onConnected)
// this happens when the DTH isn't listening yet
}
}

if (!socket.Connected)
{
// reached timeout
_logger.LogError("Failed to launch DesignTimeHost in a timely fashion.");
return;
}
}

if (_designTimeHostProcess.HasExited)
Expand All @@ -98,7 +105,7 @@ public void Start(string hostId, Action<int> onConnected)
onConnected(port);
}
}

public void Stop()
{
lock (_processLock)
Expand Down

0 comments on commit 3bf3018

Please sign in to comment.