Changeset 1264


Ignore:
Timestamp:
Mar 28, 2010, 12:37:11 AM (12 years ago)
Author:
arnold
Message:

Little changes in P2PManager and P2PWorker

Location:
trunk/CrypPlugins
Files:
2 edited

Legend:

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

    r1254 r1264  
    232232                    break;
    233233                default:
    234                     GuiLogging("Obscure Message (" + Encoding.UTF8.GetString(data) + ") received from '" + sender.ToString() + "'.", NotificationLevel.Info);
     234                    GuiLogging("Obscure Message. First byte: " + Convert.ToInt32(data[0]) + ". Data: (" + Encoding.UTF8.GetString(data) + ") received from '" + sender.ToString() + "'.", NotificationLevel.Info);
    235235                    break;
    236236            } // end switch
  • trunk/CrypPlugins/PeerToPeerWorker_NEW/P2PJobAdminBase.cs

    r1254 r1264  
    5757
    5858        private IControlWorker workerControl;
     59        private static int WAITING_FOR_JOBS = 5000;
    5960
    6061        /// <summary>
     
    6263        /// although there are some jobs to distribute...
    6364        /// </summary>
    64         Timer timerWaitingForJobs = new Timer(5000);
     65        Timer timerWaitingForJobs = new Timer(WAITING_FOR_JOBS);
    6566
    6667        /// <summary>
     
    175176            if (JobMessages.GetMessageJobType(data[0]) == MessageJobType.JobPart)
    176177            {
     178                //added by Arnold 2010.03.22
     179                this.timerWaitingForJobs.Stop(); //when receiving a new job, time can be stopped
     180
    177181                BigInteger jobId = null;
    178182                GuiLogging("Received a JobPart from '" + senderId.ToString() + "'", NotificationLevel.Debug);
     
    279283            if (!isWorking)
    280284            {
     285                this.timerWaitingForJobs.Interval += 2000; // every time this event is thrown, heighten the timer interval
    281286                base.SendRegMsg();
    282287                this.p2pControl.SendToPeer(JobMessages.CreateFreeWorkerStatusMessage(true), base.ActualPublisher);
     
    285290            else
    286291            {
     292                // reset timer interval - it could be heighten in the if brace...
     293                this.timerWaitingForJobs.Interval = WAITING_FOR_JOBS;
    287294                // when Worker is working, than the time can be stopped
    288                 timerWaitingForJobs.Stop();
    289                 GuiLogging("Next trial to send 'free worker'-Mesasge was successful, so the timer was stopped.", NotificationLevel.Info);
     295                this.timerWaitingForJobs.Stop();
    290296            }
    291297        }
Note: See TracChangeset for help on using the changeset viewer.