From 35d5e9a3b450c288fb5dd736b24cbf84d345122c Mon Sep 17 00:00:00 2001 From: John-Mark Gurney Date: Sat, 8 Jul 2006 19:13:04 -0800 Subject: [PATCH] keep track of the last few requests that we have processed, we now don't need to print out the browse lines to log, we can just take a peak at the ring buffer to see what's happened... [git-p4: depot-paths = "//depot/": change = 848] --- ContentDirectory.py | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/ContentDirectory.py b/ContentDirectory.py index 7e8695b..d31df57 100644 --- a/ContentDirectory.py +++ b/ContentDirectory.py @@ -22,6 +22,8 @@ # traceback.print_exc(file = log.logfile) # +reqname = 'requests' + from twisted.python import log from twisted.web import resource, static @@ -32,6 +34,7 @@ from DIDLLite import DIDLElement, Container, Movie, Resource, MusicTrack from twisted.internet import defer from twisted.python import failure +import debug import traceback from urllib import quote @@ -136,6 +139,9 @@ class ContentDirectoryControl(UPnPPublisher, dict): return self.children[item][:] def __init__(self, title, *args, **kwargs): + log.msg('ringbuf') + debug.insertringbuf(reqname) + print `debug.insertringbuf` super(ContentDirectoryControl, self).__init__(*args) self.webbase = kwargs['webbase'] self._urlbase = kwargs['urlbase'] @@ -173,10 +179,21 @@ class ContentDirectoryControl(UPnPPublisher, dict): BrowseFlags = ('BrowseMetaData', 'BrowseDirectChildren') def soap_Browse(self, *args): + l = {} + log.msg('ringbuf append') + debug.appendnamespace(reqname, l) + l['query'] = 'Browse(ObjectID=%s, BrowseFlags=%s, Filter=%s, ' \ + 'StartingIndex=%s RequestedCount=%s SortCriteria=%s)' % \ + tuple(map(repr, args)) + try: - return self.thereal_soap_Browse(*args) + ret = self.thereal_soap_Browse(*args) except defer.Deferred, x: - return doRecallgen(x, self.soap_Browse, *args) + ret = doRecallgen(x, self.soap_Browse, *args) + + l['response'] = `ret` + + return ret def thereal_soap_Browse(self, *args): """Required: Incrementally browse the native heirachy of the Content @@ -223,11 +240,6 @@ class ContentDirectoryControl(UPnPPublisher, dict): #log.msg('Returning: %s' % result) - log.msg('Browse(ObjectID=%s, BrowseFlags=%s, Filter=%s, ' - 'StartingIndex=%s RequestedCount=%s SortCriteria=%s) = %s' % - (`ObjectID`, `BrowseFlag`, `Filter`, `StartingIndex`, - `RequestedCount`, `SortCriteria`, `result`)) - return result # Optional actions