/// <summary> /// 发送广播的后台任务 /// </summary> private static void SendTask() { _state = 2; while (_state == 2) { if (!_items.StartProcess(out var item, 100)) { continue; } if (!GetSocket(item.Station, out var socket)) { LogRecorder.Trace(LogType.Error, "Publish", $@"因为无法找到站点而导致向【{item.Station}】广播的主题为【{item.Title}】的消息被遗弃,内容为: {item.Content}"); _items.EndProcess(); continue; } if (!Send(socket, item)) { LogRecorder.Trace(LogType.Warning, "Publish", $@"向【{item.Station}】广播的主题为【{item.Title}】的消息发送失败,内容为: {item.Content}"); continue; } _items.EndProcess(); } _state = 4; }
public IApiResult TaskTest() { LogRecorder.Trace(Task.CurrentId?.ToString()); Task.Delay(100); LogRecorder.Trace(Task.CurrentId?.ToString()); LogRecorder.Trace("VoidAsync"); return(ApiResultHelper.Succees()); }
private static string GetHostIps() { var ips = new StringBuilder(); try { var first = true; string hostName = Dns.GetHostName(); LogRecorder.Trace("HostName:{0}", hostName); foreach (var address in Dns.GetHostAddresses(hostName)) { if (address.IsIPv4MappedToIPv6 || address.IsIPv6LinkLocal || address.IsIPv6Multicast || address.IsIPv6SiteLocal || address.IsIPv6Teredo) { continue; } var ip = address.ToString(); if (ip == "127.0.0.1" || ip == "127.0.1.1" || ip == "::1" || ip == "-1") { continue; } if (first) { first = false; } else { ips.Append(" , "); } ips.Append(ip); } } catch (Exception e) { LogRecorder.Exception(e); } return(ips.ToString()); }
public Task VoidAsync() { LogRecorder.Trace(Task.CurrentId?.ToString()); return(Task.Factory.StartNew(TaskTest)); }
public Task <IApiResult> FullAsync(Argument arg) { LogRecorder.Trace($"FullAsync : {arg.Value}"); LogRecorder.Trace(Task.CurrentId?.ToString()); return(Task.Factory.StartNew(TaskTest)); }
public async Task ArgumentAsync(Argument arg) { LogRecorder.Trace($"ArgumentAsync : {arg.Value}"); await Task.Factory.StartNew(TaskTest); }
public async Task <IApiResult> ResultAsync() { LogRecorder.Trace($"ResultAsync"); return(await Task.Factory.StartNew(TaskTest)); }
public void Argument(Argument arg) { LogRecorder.Trace($"Argument : {arg.Value}"); }
public void GetVoid() { LogRecorder.Trace("GetVoid"); }
public string Full(int name) { LogRecorder.Trace("Full"); return("Full"); }
public IApiResult Result() { LogRecorder.Trace("Result"); return(ApiResultHelper.Succees()); }
public ApiResult Get() { LogRecorder.Trace("Call"); return(ApiResult.Succees()); }
/// <summary> /// 校验证书 /// </summary> /// <param name="certificate"> 证书 </param> public override void Validate(X509Certificate2 certificate) { LogRecorder.Trace(certificate.Subject); LogRecorder.Trace(certificate.Thumbprint); }