Author: atagar Date: 2011-03-23 03:21:22 +0000 (Wed, 23 Mar 2011) New Revision: 24417
Modified: arm/trunk/armrc.sample arm/trunk/src/interface/connections/connEntry.py arm/trunk/src/interface/connections/connPanel.py Log: Marking the uptimes for intial connections (arm only tracks connection uptimes since starting, so these uptimes are just minimum durations)
Modified: arm/trunk/armrc.sample =================================================================== --- arm/trunk/armrc.sample 2011-03-22 15:51:53 UTC (rev 24416) +++ arm/trunk/armrc.sample 2011-03-23 03:21:22 UTC (rev 24417) @@ -175,6 +175,12 @@ # connection resolution rate then reducing this won't casue new data to # appear more frequently - just increase the rate at which the uptime field # is updated) +# markInitialConnections +# if true, the uptime of the initial connections when we start are marked +# with a '+' (these uptimes are estimates since arm can only track a +# connection's duration while it runs) +# showExitPort +# shows port related information of exit connections we relay if true # showColumn.* # toggles the visability of the connection table columns
@@ -183,6 +189,7 @@ features.connection.listingType 0 features.connection.order 0, 2, 1 features.connection.refreshRate 10 +features.connection.markInitialConnections true features.connection.showExitPort true features.connection.showColumn.fingerprint true features.connection.showColumn.nickname true
Modified: arm/trunk/src/interface/connections/connEntry.py =================================================================== --- arm/trunk/src/interface/connections/connEntry.py 2011-03-22 15:51:53 UTC (rev 24416) +++ arm/trunk/src/interface/connections/connEntry.py 2011-03-23 03:21:22 UTC (rev 24417) @@ -29,7 +29,8 @@ LABEL_FORMAT = "%s --> %s %s%s" LABEL_MIN_PADDING = 2 # min space between listing label and following data
-CONFIG = {"features.connection.showExitPort": True, +CONFIG = {"features.connection.markInitialConnections": True, + "features.connection.showExitPort": True, "features.connection.showColumn.fingerprint": True, "features.connection.showColumn.nickname": True, "features.connection.showColumn.destination": True, @@ -181,6 +182,7 @@ self.local = Endpoint(lIpAddr, lPort) self.foreign = Endpoint(fIpAddr, fPort) self.startTime = time.time() + self.isInitialConnection = False
# True if the connection has matched the properties of a client/directory # connection every time we've checked. The criteria we check is... @@ -261,8 +263,12 @@ myListing = entries.ConnectionPanelLine.getListingEntry(self, width, currentTime, listingType)
# fill in the current uptime and return the results + if CONFIG["features.connection.markInitialConnections"]: + timePrefix = "+" if self.isInitialConnection else " " + else: timePrefix = "" + timeEntry = myListing.getNext() - timeEntry.text = "%5s" % uiTools.getTimeLabel(currentTime - self.startTime, 1) + timeEntry.text = timePrefix + "%5s" % uiTools.getTimeLabel(currentTime - self.startTime, 1)
return myListing
@@ -277,12 +283,13 @@ # postType - ") "
lineFormat = uiTools.getColor(CATEGORY_COLOR[entryType]) + timeWidth = 6 if CONFIG["features.connection.markInitialConnections"] else 5
drawEntry = uiTools.DrawEntry(")" + " " * (9 - len(entryType)), lineFormat) drawEntry = uiTools.DrawEntry(entryType.upper(), lineFormat | curses.A_BOLD, drawEntry) drawEntry = uiTools.DrawEntry(" (", lineFormat, drawEntry) - drawEntry = uiTools.DrawEntry(" " * 5, lineFormat, drawEntry) - drawEntry = uiTools.DrawEntry(self._getListingContent(width - 17, listingType), lineFormat, drawEntry) + drawEntry = uiTools.DrawEntry(" " * timeWidth, lineFormat, drawEntry) + drawEntry = uiTools.DrawEntry(self._getListingContent(width - (12 + timeWidth), listingType), lineFormat, drawEntry) return drawEntry
def _getDetails(self, width):
Modified: arm/trunk/src/interface/connections/connPanel.py =================================================================== --- arm/trunk/src/interface/connections/connPanel.py 2011-03-22 15:51:53 UTC (rev 24416) +++ arm/trunk/src/interface/connections/connPanel.py 2011-03-23 03:21:22 UTC (rev 24417) @@ -65,6 +65,11 @@
self._update() # populates initial entries
+ # mark the initially exitsing connection uptimes as being estimates + for entry in self._entries: + if isinstance(entry, connEntry.ConnectionEntry): + entry.getLines()[0].isInitialConnection = True + # TODO: should listen for tor shutdown # TODO: hasn't yet had its pausing functionality tested (for instance, the # key handler still accepts events when paused)