From zothar at freenetproject.org Fri Sep 7 21:51:21 2007 From: zothar at freenetproject.org (zothar at freenetproject.org) Date: Fri, 7 Sep 2007 21:51:21 +0000 (UTC) Subject: [Pyfreenet] r15020 - trunk/apps/pyFreenet/fcp Message-ID: <20070907215121.BE2A6479835@freenetproject.org> Author: zothar Date: 2007-09-07 21:51:21 +0000 (Fri, 07 Sep 2007) New Revision: 15020 Modified: trunk/apps/pyFreenet/fcp/node.py Log: pyFreenet: Fix followRedirect option propagation problem of fcp/node.get(). Make _getUniqueId() also contain a random component and not just based on time alone. Use a different id when following a RedirectURI from the node. Modified: trunk/apps/pyFreenet/fcp/node.py =================================================================== --- trunk/apps/pyFreenet/fcp/node.py 2007-09-07 20:36:09 UTC (rev 15019) +++ trunk/apps/pyFreenet/fcp/node.py 2007-09-07 21:51:21 UTC (rev 15020) @@ -23,6 +23,7 @@ import mimetypes import os import pprint +import random import select import sha import socket @@ -399,10 +400,10 @@ id = self._getUniqueId() opts['async'] = kw.pop('async', False) + opts['followRedirect'] = kw.pop('followRedirect', False) opts['waituntilsent'] = kw.get('waituntilsent', False) if kw.has_key('callback'): opts['callback'] = kw['callback'] - opts['Persistence'] = kw.pop('persistence', 'connection') if kw.get('Global', False): print "global get" @@ -2089,6 +2090,7 @@ if job.followRedirect and msg.get('ShortCodeDescription', None) == "New URI": uri = msg['RedirectURI'] job.kw['URI'] = uri + job.kw['id'] = self._getUniqueId(); self._txMsg(job.cmd, **job.kw) log(DETAIL, "Redirect to %s" % uri) return @@ -2096,6 +2098,7 @@ if job.followRedirect and msg.get('ShortCodeDescription', None) == "Too many path components": uri = msg['RedirectURI'] job.kw['URI'] = uri + job.kw['id'] = self._getUniqueId(); self._txMsg(job.cmd, **job.kw) log(DETAIL, "Redirect to %s" % uri) return @@ -2364,7 +2367,9 @@ """ Allocate a unique ID for a request """ - return "id" + str(int(time.time() * 1000000)) + timenum = int( time.time() * 1000000 ); + randnum = random.randint( 0, timenum ); + return "id" + str( timenum + randnum ); #@-node:_getUniqueId #@+node:_txMsg From pyfreenet at freenetproject.org Mon Sep 24 11:50:24 2007 From: pyfreenet at freenetproject.org (pyfreenet at freenetproject.org) Date: Mon, 24 Sep 2007 11:50:24 +0000 (UTC) Subject: [Pyfreenet] *****SPAM***** Magazine Message-ID: <20070924025028.5117.qmail@evf143.neoplus.adsl.tpnet.pl> An embedded and charset-unspecified text was scrubbed... Name: not available Url: http://emu.freenetproject.org/pipermail/pyfreenet/attachments/20070924/15d2a2bc/attachment.txt -------------- next part -------------- An embedded message was scrubbed... From: Subject: Magazine Date: Mon, 24 Sep 2007 11:50:24 +0000 (UTC) Size: 2341 Url: http://emu.freenetproject.org/pipermail/pyfreenet/attachments/20070924/15d2a2bc/attachment.eml