Ignore:
Timestamp:
Apr 24, 2010, 5:20:27 PM (12 years ago)
Author:
arnold
Message:

P2PManager/Worker: Manager sends a "no more jobs left" message to the requesting worker or after receiving the last job result to all active registered workers. After receiving this message, the workers stop their "waiting for new jobs" timer, which sends "free worker" messages to the Manager periodically.
For future use: After worker has received the "no more jobs left" message from the Manager, it should register with a new Manager to computate more jobs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/CrypPlugins/PeerToPeerManager_NEW/P2PManagerBase_NEW.cs

    r1264 r1348  
    2727 *   isn't implemented yet ((de)serialization of the subscribers is
    2828 *   implemented and tested)
    29  * - Manager-change is possible, but catch job history isn't implemented yes
     29 * - Manager-change is possible, but catch job history isn't implemented yet
    3030 *   ((de)serialization of job management lists)
    3131 * - Benchmarking the working peers
     
    167167             * Manager can replace it and then allocate Jobs to the free workers*/
    168168            GuiLogging("All Job results received, so deregistering from the solution network to accomodate this topic for another Manager.",NotificationLevel.Info);
     169
     170            // added by Arnie 2010.04.24
     171            SendNoMoreJobsLeftMsgToAllWorkers();
     172
    169173            Stop(PubSubMessageType.Unregister);
     174        }
     175
     176        // added by Arnie 2010.04.24
     177        private void SendNoMoreJobsLeftMsgToAllWorkers()
     178        {
     179            int i = 0;
     180            byte[] noMoreJobsLeftMsg = JobMessages.CreateNoMoreJobsLeftMessage();
     181            foreach (PeerId wkr in base.peerManagement.GetAllSubscribers())
     182            {
     183                this.p2pControl.SendToPeer(noMoreJobsLeftMsg, wkr);
     184                i++;
     185            }
     186            GuiLogging("Sended 'No more jobs left' messages to " + i + " workers.", NotificationLevel.Debug);
    170187        }
    171188
     
    467484                else
    468485                {
    469                     //todo: insert sending "no more jobs left msg" to the free worker, so it can stop its Free-Msg-Timer
     486                    //edited by Arnie 2010.04.24
     487                    //sending "no more jobs left msg" to the free worker, so it can stop its Free-Msg-Timer
     488                    base.p2pControl.SendToPeer(JobMessages.CreateNoMoreJobsLeftMessage(), worker);
     489
    470490                    GuiLogging("No more jobs left. So wait for the last results, than close this task.", NotificationLevel.Debug);
    471491                    if (OnNoMoreJobsLeft != null)
Note: See TracChangeset for help on using the changeset viewer.