Ignore:
Timestamp:
Nov 25, 2010, 8:08:50 PM (11 years ago)
Author:
Sven Rech
Message:

P2P reconnect only when SystemLeft event is triggered by connection failure

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypP2P/Internal/ConnectionManager.cs

    r2115 r2129  
    3535        private DateTime lastConnectionAttempt;
    3636        private Dispatcher guiLogDispatcher = null;
     37        private bool disconnected = false;
    3738
    3839        public ConnectionManager(P2PBase p2PBase)
     
    4344            p2PBase.OnSystemLeft += new P2PBase.SystemLeft(delegate
    4445                                                               {
     46                                                                   if (disconnected)
     47                                                                       return;
     48
    4549                                                                   //Enforce a minimum of 2 seconds between each connection attempt:
    4650                                                                   if ((lastConnectionAttempt - DateTime.Now).TotalSeconds < 2)
     
    7680            lock (connectLock)
    7781            {
     82                disconnected = false;
    7883                lastConnectionAttempt = DateTime.Now;
    7984
     
    102107            lock (connectLock)
    103108            {
     109                disconnected = true;
    104110                if (!p2PBase.IsConnected || IsConnecting)
    105111                {
Note: See TracChangeset for help on using the changeset viewer.