added report about pdq and server disconnect
This commit is contained in:
+27
-5
@@ -76,6 +76,7 @@ namespace Creditcall.ChipDna.Client
|
||||
listener.Prefixes.Add("http://127.0.0.1:18181/start-and-confirm-transaction/");
|
||||
listener.Prefixes.Add("http://127.0.0.1:18181/transaction-information/");
|
||||
listener.Prefixes.Add("http://127.0.0.1:18181/void-transaction/");
|
||||
listener.Prefixes.Add("http://127.0.0.1:18181/chipdna-status/");
|
||||
listener.Start();
|
||||
|
||||
Console.WriteLine("Listening on:");
|
||||
@@ -83,6 +84,7 @@ namespace Creditcall.ChipDna.Client
|
||||
Console.WriteLine(" http://127.0.0.1:18181/start-and-confirm-transaction/");
|
||||
Console.WriteLine(" http://127.0.0.1:18181/transaction-information/");
|
||||
Console.WriteLine(" http://127.0.0.1:18181/void-transaction/");
|
||||
Console.WriteLine(" http://127.0.0.1:18181/chipdna-status/");
|
||||
|
||||
while (true)
|
||||
{
|
||||
@@ -115,7 +117,10 @@ namespace Creditcall.ChipDna.Client
|
||||
{
|
||||
HandleVoidTransaction(context);
|
||||
}
|
||||
else
|
||||
else if (rawUrl.StartsWith("/chipdna-status", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
HandleGetStatus(context);
|
||||
}
|
||||
{
|
||||
context.Response.StatusCode = 404;
|
||||
context.Response.Close();
|
||||
@@ -134,6 +139,27 @@ namespace Creditcall.ChipDna.Client
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleGetStatus(HttpListenerContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
var statusResult = client.GetStatus();
|
||||
var responseSerializer = new XmlSerializer(typeof(SerializableKeyValueList));
|
||||
context.Response.ContentType = "application/xml";
|
||||
var wrappedResult = new SerializableKeyValueList(statusResult);
|
||||
responseSerializer.Serialize(context.Response.OutputStream, wrappedResult);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("Error in -status: " + ex.Message);
|
||||
context.Response.StatusCode = 500;
|
||||
}
|
||||
finally
|
||||
{
|
||||
context.Response.OutputStream.Close();
|
||||
}
|
||||
}
|
||||
|
||||
private static void HandleTransactionInformation(HttpListenerContext context)
|
||||
{
|
||||
try
|
||||
@@ -359,10 +385,6 @@ namespace Creditcall.ChipDna.Client
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private static string GetAbsolutePath(string fileName)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user