Skip to content

Commit

Permalink
Merge pull request #6 from Uninett/bugfix/tableretriever-defer-reset
Browse files Browse the repository at this point in the history
Reset self.defer at start rather than on end
  • Loading branch information
lunkwill42 authored Nov 15, 2023
2 parents 5397598 + c293172 commit abf7297
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pynetsnmp/tableretriever.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self,
limit=1000):
self.proxy = proxy
self.tableStatus = [_TableStatus(oid) for oid in oids]
self.defer = defer.Deferred()
self.defer = None
if proxy.snmpVersion.find('1') > -1:
self.how = proxy._walk
else:
Expand All @@ -34,6 +34,7 @@ def v2v3how(oids):
self.hit_limit = False

def __call__(self):
self.defer = defer.Deferred()
self.fetchSomeMore()
return self.defer

Expand All @@ -52,7 +53,6 @@ def fetchSomeMore(self):
for ts in self.tableStatus:
results[ts.startOidStr]=dict([(asOidStr(oid), value) for oid, value in ts.result])
self.defer.callback(results)
self.defer = None

def saveResults(self, values, ts):
if values:
Expand All @@ -75,4 +75,4 @@ def saveResults(self, values, ts):

def error(self, why):
self.defer.errback(why)
self.defer = None

0 comments on commit abf7297

Please sign in to comment.