Merge pull request #87 from Cyberboss/rcfix

Some Interop Listener fixes
This commit is contained in:
Jordan Brown
2017-06-30 16:12:04 -04:00
committed by GitHub
2 changed files with 14 additions and 10 deletions
+4 -1
View File
@@ -407,7 +407,10 @@ namespace TGServerService
try
{
error = null;
return Convert.ToUInt16(File.ReadAllText(InteropConfig));
lock (configLock)
{
return Convert.ToUInt16(File.ReadAllText(InteropConfig));
}
}
catch (Exception e)
{
+10 -9
View File
@@ -221,16 +221,17 @@ namespace TGServerService
{
try
{
var handler = listener.EndAccept(asyncResult);
using (var handler = listener.EndAccept(asyncResult))
{
var bytes = new byte[1024];
int bytesRec = handler.Receive(bytes);
// Show the data on the console.
HandleCommand(Encoding.ASCII.GetString(bytes, 0, bytesRec));
handler.Shutdown(SocketShutdown.Both);
handler.Close();
clientConnected.Set();
var bytes = new byte[1024];
int bytesRec = handler.Receive(bytes);
// Show the data on the console.
HandleCommand(Encoding.ASCII.GetString(bytes, 0, bytesRec));
handler.Close();
clientConnected.Set();
}
}
catch (ObjectDisposedException)
{ }