On Mon, Apr 14, 2008 at 3:05 PM, Florent Daigni?re
<nextgens at freenetproject.org> wrote:
> * Daniel Cheng <j16sdiz+freenet at gmail.com> [2008-04-14 15:00:50]:
>
>
>
>  > On Mon, Apr 14, 2008 at 2:21 PM,  <nextgens at freenetproject.org> wrote:
>  > > Author: nextgens
>  > >  Date: 2008-04-14 06:21:05 +0000 (Mon, 14 Apr 2008)
>  > >  New Revision: 19304
>  > >
>  > >  Modified:
>  > >    trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
>  > >    trunk/freenet/src/freenet/keys/ClientCHKBlock.java
>  > >    trunk/freenet/src/freenet/keys/FreenetURI.java
>  > >    trunk/freenet/src/freenet/node/FailureTable.java
>  > >    trunk/freenet/src/freenet/node/PeerManager.java
>  > >    trunk/freenet/src/freenet/node/PeerNode.java
>  > >    trunk/freenet/src/freenet/support/LoggerHookChain.java
>  > >    trunk/freenet/src/freenet/support/SectoredRandomGrabArray.java
>  > >  Log:
>  > >  some paranoia code to prevent race conditions and out-of-bound 
> exceptions
>  > >
>  > >  Modified: 
> trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java
>  > >  ===================================================================
>  > >  --- trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java  
> 2008-04-14 05:28:57 UTC (rev 19303)
>  > >  +++ trunk/freenet/src/freenet/client/async/ClientRequestScheduler.java  
> 2008-04-14 06:21:05 UTC (rev 19304)
>  > >  @@ -531,10 +531,11 @@
>  > >                                 }
>  > >                         } else {
>  > >                                 SendableGet[] gets = (SendableGet[]) o;
>  > >  -                               SendableGet[] newGets = new 
> SendableGet[gets.length-1];
>  > >  +                               final int getsLength = gets.length;
>  > <snip>
>  > >  @@ -555,7 +556,7 @@
>  > >                                 } else if(x == 1) {
>  > >                                         pendingKeys.put(key, newGets[0]);
>  > >                                 } else {
>  > >  -                                       if(x != gets.length-1) {
>  > >  +                                       if(x != -1) {
>  > >                                                 SendableGet[] newNewGets 
> = new SendableGet[x];
>  > Should this be
>  >    if  ( x != getsLength-1)  {
>  > ?
>
>  Doh, fixed in r19305.
>

Is this "race condition" fix really needed?
As far as I can see, all related objects are protected by
synchronized(pendingKeys).

Regards,
Daniel Cheng

Reply via email to