Merge pull request #954 from Patrikkk/general-devel

Adding exception at used REST port problem
This commit is contained in:
Lucas Nicodemus 2015-07-06 16:42:39 -06:00
commit 1b8a49e895

View file

@ -79,12 +79,20 @@ namespace Rests
public virtual void Start()
{
if (listener == null)
try
{
listener = HttpListener.Create(Ip, Port);
listener.RequestReceived += OnRequest;
listener.Start(int.MaxValue);
}
catch (Exception ex)
{
TShock.Log.Error("Fatal Startup Exception");
TShock.Log.Error(ex.ToString());
TShock.Log.ConsoleError("Invalid REST configuration: \nYou may already have a REST service bound to port {0}. \nPlease adjust your configuration and restart the server. \nPress any key to exit.", Port);
Console.ReadLine();
Environment.Exit(1);
}
}
public void Start(IPAddress ip, int port)