Changeset 1678


Ignore:
Timestamp:
Jun 19, 2010, 12:23:08 PM (11 years ago)
Author:
Sven Rech
Message:

quadratic sieve changes

Location:
trunk/CrypPlugins/QuadraticSieve
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/QuadraticSieve/PeerToPeer.cs

    r1676 r1678  
    226226                    }
    227227
    228                     //updates all peer performances which have last been checked more than 2 minutes ago and check if they are still alive:
    229                     while (peerPerformances.Count != 0 && peerPerformances.Peek().lastChecked.CompareTo(DateTime.Now.Subtract(new TimeSpan(0, 2, 0))) < 0)
     228                    //updates all peer performances which have last been checked more than 1 minutes and 20 seconds ago and check if they are still alive:
     229                    while (peerPerformances.Count != 0 && peerPerformances.Peek().lastChecked.CompareTo(DateTime.Now.Subtract(new TimeSpan(0, 1, 20))) < 0)
    230230                    {
    231231                        var e = peerPerformances.Dequeue();
     
    247247                        {
    248248                            activePeers.Remove(e.peerID);
     249                            UpdateActivePeerInformation();
    249250                        }                       
    250251                    }
  • trunk/CrypPlugins/QuadraticSieve/ProgressYields.xaml.cs

    r1648 r1678  
    2121    {
    2222        private int ourID;
     23        private ScrollViewer scrollViewer;
    2324
    2425        public void Set(int i, int id, string name)
     
    125126            root.Children.Add(shape);
    126127            SetShapeToStatus(root.Children.Count-1, id, name);
     128            scrollViewer.ScrollToBottom();
    127129        }
    128130
     
    164166        }
    165167
    166         public ProgressYields()
     168        public ProgressYields(ScrollViewer scrollViewer)
    167169        {
    168170            InitializeComponent();
    169171            root.Children.Clear();
     172            this.scrollViewer = scrollViewer;
    170173        }
    171174    }
  • trunk/CrypPlugins/QuadraticSieve/QuadraticSieve.cs

    r1676 r1678  
    106106            quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    107107            {
    108                 quadraticSieveQuickWatchPresentation.peer2peer.Visibility = settings.UsePeer2Peer ? Visibility.Visible : Visibility.Collapsed;
    109                 quadraticSieveQuickWatchPresentation.Redraw();
     108                quadraticSieveQuickWatchPresentation.peer2peer.Visibility = settings.UsePeer2Peer ? Visibility.Visible : Visibility.Collapsed;               
    110109                quadraticSieveQuickWatchPresentation.timeLeft.Text = "?";
    111110                quadraticSieveQuickWatchPresentation.endTime.Text = "?";
     
    136135                    quadraticSieveQuickWatchPresentation.Dispatcher.Invoke(DispatcherPriority.Normal, (SendOrPostCallback)delegate
    137136                    {
    138                         quadraticSieveQuickWatchPresentation.peer2peer.Visibility = settings.UsePeer2Peer ? Visibility.Visible : Visibility.Collapsed;
    139                         quadraticSieveQuickWatchPresentation.Redraw();
     137                        quadraticSieveQuickWatchPresentation.peer2peer.Visibility = settings.UsePeer2Peer ? Visibility.Visible : Visibility.Collapsed;                       
    140138                    }, null);
    141139                }
     
    735733            if (conf_list != null)
    736734            {
    737                 running = false;
     735                running = false;               
     736
     737                MethodInfo stop = msieve.GetMethod("stop");
     738                MethodInfo getObjFromConf = msieve.GetMethod("getObjFromConf");
     739
     740                conf_listMutex.WaitOne();
     741                foreach (Object conf in conf_list)
     742                    if (conf != null)
     743                        stop.Invoke(null, new object[] { getObjFromConf.Invoke(null, new object[] { (IntPtr)conf }) });
     744
     745                conf_list = null;
     746                conf_listMutex.ReleaseMutex();
     747
    738748                if (usePeer2Peer)
    739749                    peerToPeer.StopLoadStoreThread();
    740 
    741                 MethodInfo stop = msieve.GetMethod("stop");
    742                 MethodInfo getObjFromConf = msieve.GetMethod("getObjFromConf");
    743 
    744                 conf_listMutex.WaitOne();
    745                 foreach (IntPtr conf in conf_list)
    746                     if (conf != null)
    747                         stop.Invoke(null, new object[] { getObjFromConf.Invoke(null, new object[] { conf }) });
    748 
    749                 conf_list = null;
    750                 conf_listMutex.ReleaseMutex();
    751750
    752751                GuiLogMessage("Waiting for threads to stop!", NotificationLevel.Debug);
  • trunk/CrypPlugins/QuadraticSieve/QuadraticSievePresentation.xaml.cs

    r1677 r1678  
    2020    public partial class QuadraticSievePresentation : UserControl
    2121    {
    22         private ProgressYields progressYields = new ProgressYields();
     22        private ProgressYields progressYields;
    2323        public ProgressYields ProgressYields
    2424        {
     
    3535            sviewer.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
    3636            sviewer.VerticalScrollBarVisibility = ScrollBarVisibility.Visible;
     37            progressYields = new ProgressYields(sviewer);
    3738            sviewer.Content = progressYields;
    3839            Grid grid = ((Grid)peer2peer.Content);
     
    4647        public void sizeChanged(Object sender, EventArgs eventArgs)
    4748        {
    48             this.Grid.RenderTransform = new ScaleTransform( this.ActualWidth / this.Grid.ActualWidth,
    49                                                        this.ActualHeight / this.Grid.ActualHeight);
     49            double scale = Math.Min((this.ActualWidth / this.Grid.ActualWidth), (this.ActualHeight / this.Grid.ActualHeight));
     50            this.Grid.RenderTransform = new ScaleTransform(scale, scale);
    5051        }
    5152
    52         public void Redraw()
    53         {
    54             //TODO: Redraw here
    55         }
    5653    }
    5754}
Note: See TracChangeset for help on using the changeset viewer.