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/PeerToPeerJobs/JobMessages.cs

    r1155 r1348  
    4444        /// messages FROM the Manager TO the P2PJobAdmin)
    4545        /// </summary>
    46         JobPart = 203
     46        JobPart = 203,
     47        /// <summary>
     48        /// Manager should send this msgType to all requesting
     49        /// workers, when it has no more jobs left
     50        /// </summary>
     51        NoMoreJobsLeft = 204
    4752    }
    4853
     
    267272                    retValue = false;
    268273                else
     274                    retValue = true;
     275            }
     276            return retValue;
     277        }
     278
     279        // TODO: Create NoMoreJobsLeft Msg
     280
     281        /// <summary>
     282        /// When the Manager has no more jobs left, it should send a "no more
     283        /// jobs left" message to all job-requesting Workers.
     284        /// </summary>
     285        /// <returns>serialized "no more jobs left" message</returns>
     286        public static byte[] CreateNoMoreJobsLeftMessage()
     287        {
     288            byte[] retValue = new byte[2];
     289            retValue[0] = (byte)MessageJobType.NoMoreJobsLeft;
     290            retValue[1] = 1;
     291            return retValue;
     292        }
     293
     294        /// <summary>
     295        /// Only workers can receive this message type. Manager sent
     296        /// this Msg, when it has no more jobs left to allocate.
     297        /// </summary>
     298        /// <param name="msg"></param>
     299        /// <returns></returns>
     300        public static bool GetNoMoreJobsLeftMessage(byte[] msg)
     301        {
     302            bool retValue = false;
     303            if ((MessageJobType)msg[0] == MessageJobType.NoMoreJobsLeft && msg.Length == 2)
     304            {
     305                if (msg[1] == 1)
    269306                    retValue = true;
    270307            }
Note: See TracChangeset for help on using the changeset viewer.