private void Send(string cmd) { var sessionIdBase = Guid.NewGuid().ToString("N").Substring(0, 6) + "-"; int retries = 3; int duration = 1000; while (retries > 0) { var sessionId = sessionIdBase + (3 - retries); retries--; Log.Inform(string.Format("UID: {0}: {1}", sessionId, cmd)); try { pa.user_id(cmd); Log.Inform(string.Format("UID: {0}: ok", sessionId)); return; } catch (Exception ex) { Log.Inform("UID EXCEPTION: " + ex.ToString()); Log.Inform(string.Format("UID: {0}: fail", sessionId)); using (var taskDelay = Task.Delay(duration)) { taskDelay.Wait(); } duration *= 2; pa = pa.Reconnect(); } finally { Log.Flush(); } } Log.Inform(string.Format("UID: {0}2: ABORT", sessionIdBase)); }
private void Reconnect() { try { pa = pa.Reconnect(); } catch (Exception ex) { Log.Inform("PanXmlApi Exception: " + ex.ToString()); } finally { Log.Flush(); } }
public static void New(PanXmlApi pa) { singleton = new MapUserIp(pa); }
private MapUserIpSimple(PanXmlApi _pa) { pa = _pa; }
private MapUserIp(PanXmlApi _pa) { pa = _pa; Reset(); }