예제 #1
0
        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));
        }
예제 #2
0
 private void Reconnect()
 {
     try {
         pa = pa.Reconnect();
     } catch (Exception ex) {
         Log.Inform("PanXmlApi Exception: " + ex.ToString());
     } finally {
         Log.Flush();
     }
 }
예제 #3
0
 public static void New(PanXmlApi pa)
 {
     singleton = new MapUserIp(pa);
 }
예제 #4
0
 private MapUserIpSimple(PanXmlApi _pa)
 {
     pa = _pa;
 }
예제 #5
0
 private MapUserIp(PanXmlApi _pa)
 {
     pa = _pa;
     Reset();
 }