January 29th, 2005

  • evan

small annoyance: syncitems and repeated requests

The “broken client loop” prevention is well-known to be annoying when trying to develop an offline client. I notice that, even more annoyingly, if you’re currently in the “too many repeated requests” state and you try to sync again, your current request is stored as yet another attempt before you’re rejected. This means that if I check back too soon to see if my holding period has expired, I’m getting more black marks against me.

Proposed fix: in this code in ljprotocol.pl:
            LJ::set_userprop($dbs, $u, $pname, 
                             join(‘/’, map { $_, $reqs{$_} }
                                  sort { $b <=> $a } keys %reqs));
            if ($count >= 2) {
                # 2 prior, plus this one = 3 repeated requests for same synctime.
                # their client is busted.  (doesn’t understand syncitems semantics)
                return fail($err,406);
            }

Swap the order of the “if” and the “set_userprop”.