aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Server/Program.cs
diff options
context:
space:
mode:
authorMichael VanOverbeek <[email protected]>2017-02-16 15:28:08 +0000
committerMichael VanOverbeek <[email protected]>2017-02-16 15:28:08 +0000
commit781351aefb5d4fe7d9770568506345156b605b9a (patch)
treee0cff848b59ce59cec84fab0fd2ed388f974a8a3 /ShiftOS.Server/Program.cs
parent5a89c2ad6b644f94d1a72d91f431852069a0c6cd (diff)
downloadshiftos_thereturn-781351aefb5d4fe7d9770568506345156b605b9a.tar.gz
shiftos_thereturn-781351aefb5d4fe7d9770568506345156b605b9a.tar.bz2
shiftos_thereturn-781351aefb5d4fe7d9770568506345156b605b9a.zip
Fix error handler bug with false errors
It was throwing false 'request not found in protocol' errors!
Diffstat (limited to 'ShiftOS.Server/Program.cs')
-rw-r--r--ShiftOS.Server/Program.cs27
1 files changed, 12 insertions, 15 deletions
diff --git a/ShiftOS.Server/Program.cs b/ShiftOS.Server/Program.cs
index 4db3894..020fd13 100644
--- a/ShiftOS.Server/Program.cs
+++ b/ShiftOS.Server/Program.cs
@@ -231,12 +231,12 @@ namespace ShiftOS.Server
{
foreach (var attrib in method.GetCustomAttributes(false))
{
- new Thread(() =>
+ if (attrib is MudRequestAttribute)
{
- if (attrib is MudRequestAttribute)
+ var mAttrib = attrib as MudRequestAttribute;
+ if (mAttrib.RequestName == msg.Name)
{
- var mAttrib = attrib as MudRequestAttribute;
- if (mAttrib.RequestName == msg.Name)
+ new Thread(() =>
{
try
{
@@ -244,7 +244,7 @@ namespace ShiftOS.Server
bool throwOnNull = false;
- if(mAttrib.ExpectedType == typeof(int))
+ if (mAttrib.ExpectedType == typeof(int))
{
int result = 0;
if (int.TryParse(msg.Contents, out result) == true)
@@ -256,7 +256,7 @@ namespace ShiftOS.Server
throw new MudException($"Protocol error: {msg.Name} expects a 32-bit signed integer for the message contents.");
}
}
- else if(mAttrib.ExpectedType == typeof(long))
+ else if (mAttrib.ExpectedType == typeof(long))
{
long result = 0;
if (long.TryParse(msg.Contents, out result) == true)
@@ -268,10 +268,10 @@ namespace ShiftOS.Server
throw new MudException($"Protocol error: {msg.Name} expects a 64-bit signed integer for the message contents.");
}
}
- else if(mAttrib.ExpectedType == typeof(bool))
+ else if (mAttrib.ExpectedType == typeof(bool))
{
throwOnNull = true;
- if(msg.Contents.ToLower() == "true")
+ if (msg.Contents.ToLower() == "true")
{
contents = true;
}
@@ -285,7 +285,7 @@ namespace ShiftOS.Server
throw new MudException("Protocol error: " + msg.Name + " expects a content type of 'boolean'. Please send either 'true' or 'false'.");
}
}
- else if(mAttrib.ExpectedType == null)
+ else if (mAttrib.ExpectedType == null)
{
throwOnNull = false;
}
@@ -314,14 +314,11 @@ namespace ShiftOS.Server
Console.WriteLine(mEx);
ClientDispatcher.DispatchTo("Error", msg.GUID, mEx);
}
- catch
- {
- Console.WriteLine($@"[{DateTime.Now}] {method.Name}: Missing guid and content parameters, request handler NOT RAN.");
- }
return;
- }
+ }).Start();
+ return;
}
- }).Start();
+ }
}
}
}