Page 1 of 1

AllDownloaders Iterator Problem

Posted: Sun Aug 08, 2010 12:12 am
by Pravin
I've recently noticed (on 227g) that the AllDownloaders iterator "predicts" how much a client has received, and reports incorrect values. I've often seen downloaders reach 180% of the current file they're downloading (somehow)... and I think it's because how much of the file they have received is being predicted by memorizing DL rates... Could this prediction scheme please be removed? It doesn't make sense to me why something as important as % downloaded should ever be predicted.

Re: AllDownloaders Iterator Problem

Posted: Sun Aug 08, 2010 9:36 am
by .:..:
Well there is no prediction:
[code]void ALevelInfo::execAllDownloaders(FFrame& Stack, RESULT_DECL)
{
     guard(ALevelInfo::execAllDownloaders);
     P_GET_OBJECT_REF(UNetConnection,Connect)
     P_GET_STR_REF(File)
     P_GET_INT_REF(Sent)
     P_GET_INT_REF(TotalSz)
     P_FINISH;

     // Get iterator end offset.
     INT wEndOffset = Stack.ReadWord();

     if( XLevel->NetDriver && XLevel->NetDriver->ClientConnections.Num() )
     {
           // Init iterator
           BYTE B=0, Buffer[MAX_CONST_SIZE];
           BYTE *StartCode = Stack.Code;

           for( INT i=0; iNetDriver->ClientConnections.Num(); i++ )
           {
                 UNetConnection* C = XLevel->NetDriver->ClientConnections(i);
                 if( C && !C->Actor && C->Channels[1] && C->Channels[1]->ChType==CHTYPE_File )
                 {
                       UFileChannel* F = (UFileChannel*)C->Channels[1];
                       if( Connect )
                             *Connect = C;
                       if( File )
                             *File = F->SrcFilename;
                       if( Sent )
                             *Sent = F->SentData;
                       if( TotalSz )
                             *TotalSz = (F->SendFileAr ? F->SendFileAr->TotalSize() : -1);

                       // Loop iterator
                       while( (B=*Stack.Code)!=EX_IteratorPop && B!=EX_IteratorNext )
                             Stack.Step( Stack.Object, Buffer );
                       if( *Stack.Code++==EX_IteratorNext )
                             Stack.Code = StartCode;
                       if( B==EX_IteratorPop )
                             return;
                 }
           }
     }
     // End iterator
     Stack.Code = &Stack.Node->Script(wEndOffset + 1);
     unguardexec;
}[/code]
How does your UnrealScript process it then?

Re: AllDownloaders Iterator Problem

Posted: Sun Aug 08, 2010 9:42 am
by Pravin
Huh. Interesting. Like this.

Code: Select all

            if( bDownloaders )
                  Foreach Level.AllDownloaders( Connection, Filename, Sent, TotalSize )
                  {
                        ConData = Level.GetConOpts(Connection);
                        tempName = ParseOption(ConData,"Name");
                        For( Iteration = 0; Iteration < DLerListIndex; Iteration++ )
                        {
                              // Attempt to find the correct connection without an actor
                              If( TempName == ConnectionNameList[Iteration] )
                              {
                                    // Found it
                                    FileNameList[Iteration] = FileName;
                                    PercentageList[Iteration] = Byte(100*(Float( Sent )/Float( TotalSize )) );
                                    break;
                              }
                        }
                  }