Changeset 1537


Ignore:
Timestamp:
May 30, 2010, 6:32:44 PM (12 years ago)
Author:
Paul Lelgemann
Message:

o (probably) fixed bug with a locked P2P instance when storing large values
+ CrypP2P: Added event for connection state changes

Location:
trunk
Files:
4 edited

Legend:

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

    r1527 r1537  
    469469        public bool SynchStore(string sKey, byte[] byteData)
    470470        {
    471             LogToMonitor("Begin: SynchStore. Key: " + sKey + ", " + byteData.Length + " bytes of data: " + Encoding.UTF8.GetString(byteData) + " [" + byteData.Length + " bytes]");
     471            LogToMonitor("Begin: SynchStore. Key: " + sKey + ", " + byteData.Length + " bytes");
    472472            AutoResetEvent are = new AutoResetEvent(false);
    473473            // this method returns always a GUID to distinguish between asynchronous actions
  • trunk/CrypP2P/P2PManager.cs

    r1527 r1537  
    6868        public static event GuiLogNotificationEventHandler OnGuiLogNotificationOccured;
    6969
     70        public delegate void P2PConnectionStateChangeEventHandler(object sender, bool newState);
     71        public static event P2PConnectionStateChangeEventHandler OnP2PConnectionStateChangeOccurred;
     72
    7073        // to forward event from overlay/dht MessageReceived-Event from P2PBase
    7174        public event P2PBase.P2PMessageReceived OnPeerMessageReceived;
    7275
    7376        #endregion Events
     77
     78        internal void FireConnectionStatusChange()
     79        {
     80            if (OnP2PConnectionStateChangeOccurred != null)
     81            {
     82                OnP2PConnectionStateChangeOccurred(this, P2PConnected());
     83            }
     84        }
    7485
    7586        public bool P2PConnected()
     
    181192        #endregion DHT operations
    182193    }
     194
     195   
    183196}
  • trunk/CrypP2P/Worker/ConnectionWorker.cs

    r1527 r1537  
    4040                    : "Connection to P2P network terminated.", NotificationLevel.Info);
    4141            P2PManager.Instance.IsP2PConnecting = false;
     42            P2PManager.Instance.FireConnectionStatusChange();
    4243        }
    4344
  • trunk/CrypPlugins/P2PEditor/GUI/P2PEditorPresentation.xaml.cs

    r1527 r1537  
    5050            P2PEditorPresentation = this;
    5151
     52            P2PManager.OnP2PConnectionStateChangeOccurred += P2PManager_OnP2PConnectionStateChangeOccurred;
     53
    5254            InitializeComponent();
    5355
    5456            UpdateDisplay();
     57        }
     58
     59        private void P2PManager_OnP2PConnectionStateChangeOccurred(object sender, bool newState)
     60        {
     61            IsP2PConnected = newState;
    5562        }
    5663
Note: See TracChangeset for help on using the changeset viewer.