Author: atagar Date: 2011-03-28 16:02:37 +0000 (Mon, 28 Mar 2011) New Revision: 24488
Modified: arm/trunk/src/interface/connections/clientEntry.py arm/trunk/src/interface/connections/connEntry.py arm/trunk/src/interface/connections/connPanel.py Log: Relabeling connections (... again). PROGRAM -> SOCKS and CLIENT -> CIRCUIT.
Modified: arm/trunk/src/interface/connections/clientEntry.py =================================================================== --- arm/trunk/src/interface/connections/clientEntry.py 2011-03-28 15:51:56 UTC (rev 24487) +++ arm/trunk/src/interface/connections/clientEntry.py 2011-03-28 16:02:37 UTC (rev 24488) @@ -2,7 +2,7 @@ Connection panel entries for client circuits. This includes a header entry followed by an entry for each hop in the circuit. For instance:
-89.188.20.246:42667 --> 217.172.182.26 (de) General / Built 8.6m (CLIENT) +89.188.20.246:42667 --> 217.172.182.26 (de) General / Built 8.6m (CIRCUIT) | 85.8.28.4 (se) 98FBC3B2B93897A78CDD797EF549E6B62C9A8523 1 / Guard | 91.121.204.76 (fr) 546387D93F8D40CFF8842BB9D3A8EC477CEDA984 2 / Middle +- 217.172.182.26 (de) 5CFA9EA136C0EA0AC096E5CEA7EB674F1207CF86 3 / Exit @@ -55,7 +55,7 @@ # Overwrites attributes of the initial line to make it more fitting as the # header for our listing.
- self.lines[0].baseType = connEntry.Category.CLIENT + self.lines[0].baseType = connEntry.Category.CIRCUIT
self.update(status, path)
@@ -111,7 +111,7 @@ self.foreign.fingerprintOverwrite = exitFingerprint
def getType(self): - return connEntry.Category.CLIENT + return connEntry.Category.CIRCUIT
def getDestinationLabel(self, maxLength, includeLocale=False, includeHostname=False): if not self.isBuilt: return "Building..." @@ -154,7 +154,7 @@ self.isLast = False
def getType(self): - return connEntry.Category.CLIENT + return connEntry.Category.CIRCUIT
def getListingEntry(self, width, currentTime, listingType): """
Modified: arm/trunk/src/interface/connections/connEntry.py =================================================================== --- arm/trunk/src/interface/connections/connEntry.py 2011-03-28 15:51:56 UTC (rev 24487) +++ arm/trunk/src/interface/connections/connEntry.py 2011-03-28 16:02:37 UTC (rev 24488) @@ -18,10 +18,10 @@ # Directory Fetching tor consensus information. # Control Tor controller (arm, vidalia, etc).
-Category = enum.Enum("INBOUND", "OUTBOUND", "EXIT", "CLIENT", "DIRECTORY", "PROGRAM", "CONTROL") +Category = enum.Enum("INBOUND", "OUTBOUND", "EXIT", "CIRCUIT", "DIRECTORY", "SOCKS", "CONTROL") CATEGORY_COLOR = {Category.INBOUND: "green", Category.OUTBOUND: "blue", - Category.EXIT: "red", Category.CLIENT: "cyan", - Category.PROGRAM: "yellow", Category.DIRECTORY: "magenta", + Category.EXIT: "red", Category.CIRCUIT: "cyan", + Category.SOCKS: "yellow", Category.DIRECTORY: "magenta", Category.CONTROL: "red"}
# static data for listing format @@ -199,7 +199,7 @@ self._possibleClient = True self._possibleDirectory = True
- # attributes for PROGRAM and CONTROL connections + # attributes for SOCKS and CONTROL connections self.appName = None self.appPid = None self.isAppResolving = False @@ -219,7 +219,7 @@ self.baseType = Category.INBOUND self.local.isORPort = True elif lPort == mySocksPort: - self.baseType = Category.PROGRAM + self.baseType = Category.SOCKS elif lPort == myCtlPort: self.baseType = Category.CONTROL else: @@ -288,7 +288,7 @@ True if our display uses application information that hasn't yet been resolved. """
- return self.appName == None and self.getType() in (Category.PROGRAM, Category.CONTROL) + return self.appName == None and self.getType() in (Category.SOCKS, Category.CONTROL)
def _getListingEntry(self, width, currentTime, listingType): entryType = self.getType() @@ -367,7 +367,7 @@ if self.baseType == Category.OUTBOUND: # Currently the only non-static categories are OUTBOUND vs... # - EXIT since this depends on the current consensus - # - CLIENT if this is likely to belong to our guard usage + # - CIRCUIT if this is likely to belong to our guard usage # - DIRECTORY if this is a single-hop circuit (directory mirror?) # # The exitability, circuits, and fingerprints are all cached by the @@ -396,7 +396,7 @@
for _, status, _, path in myCircuits: if path[0] == destFingerprint and (status != "BUILT" or len(path) > 1): - self.cachedType = Category.CLIENT # matched a probable guard connection + self.cachedType = Category.CIRCUIT # matched a probable guard connection
# if we fell through, we can eliminate ourselves as a guard in the future if not self.cachedType: @@ -428,7 +428,7 @@ """
# for applications show the command/pid - if self.getType() in (Category.PROGRAM, Category.CONTROL): + if self.getType() in (Category.SOCKS, Category.CONTROL): displayLabel = ""
if self.appName: @@ -538,7 +538,7 @@ # the source and destination addresses are both private, but that might # not be perfectly reliable either.
- isExpansionType = not myType in (Category.PROGRAM, Category.CONTROL) + isExpansionType = not myType in (Category.SOCKS, Category.CONTROL)
if isExpansionType: srcAddress = myExternalIpAddr + localPort else: srcAddress = self.local.getIpAddr() + localPort @@ -613,7 +613,7 @@ # pads dst entry to its max space dst = ("%%-%is" % (baseSpace - len(src))) % dst
- if myType in (Category.INBOUND, Category.PROGRAM, Category.CONTROL): src, dst = dst, src + if myType in (Category.INBOUND, Category.SOCKS, Category.CONTROL): src, dst = dst, src padding = " " * (width - usedSpace + LABEL_MIN_PADDING) return LABEL_FORMAT % (src, dst, etc, padding)
Modified: arm/trunk/src/interface/connections/connPanel.py =================================================================== --- arm/trunk/src/interface/connections/connPanel.py 2011-03-28 15:51:56 UTC (rev 24487) +++ arm/trunk/src/interface/connections/connPanel.py 2011-03-28 16:02:37 UTC (rev 24488) @@ -63,14 +63,14 @@ # it changes. self._lastResourceFetch = -1
- # resolver for the command/pid associated with PROGRAM and CONTROL connections + # resolver for the command/pid associated with SOCKS and CONTROL connections self._appResolver = connections.AppResolver("arm")
# rate limits appResolver queries to once per update self.appResolveSinceUpdate = False
self._update() # populates initial entries - self._resolveApps(False) # resolves initial PROGRAM and CONTROL applications + self._resolveApps(False) # resolves initial SOCKS and CONTROL applications
# mark the initially exitsing connection uptimes as being estimates for entry in self._entries: @@ -202,7 +202,7 @@ for lineNum in range(scrollLoc, len(self._entryLines)): entryLine = self._entryLines[lineNum]
- # if this is an unresolved PROGRAM or CONTROL entry then queue up + # if this is an unresolved SOCKS or CONTROL entry then queue up # resolution for the applicaitions they belong to if isinstance(entryLine, connEntry.ConnectionLine) and entryLine.isUnresolvedApp(): self._resolveApps() @@ -282,7 +282,7 @@ # Adds any new connection and circuit entries. for lIp, lPort, fIp, fPort in newConnections: newConnEntry = connEntry.ConnectionEntry(lIp, lPort, fIp, fPort) - if newConnEntry.getLines()[0].getType() != connEntry.Category.CLIENT: + if newConnEntry.getLines()[0].getType() != connEntry.Category.CIRCUIT: newEntries.append(newConnEntry)
for circuitID in newCircuits: @@ -299,7 +299,7 @@ if isinstance(entry, connEntry.ConnectionEntry): typeCounts[entry.getLines()[0].getType()] += 1 elif isinstance(entry, clientEntry.ClientEntry): - typeCounts[connEntry.Category.CLIENT] += 1 + typeCounts[connEntry.Category.CIRCUIT] += 1
# makes labels for all the categories with connections (ie, # "21 outbound", "1 control", etc) @@ -324,7 +324,7 @@
def _resolveApps(self, flagQuery = True): """ - Triggers an asynchronous query for all unresolved PROGRAM and CONTROL + Triggers an asynchronous query for all unresolved SOCKS and CONTROL entries.
Arguments: @@ -334,7 +334,7 @@
if self.appResolveSinceUpdate: return
- # fetch the unresolved PROGRAM and CONTROL lines + # fetch the unresolved SOCKS and CONTROL lines unresolvedLines = []
for line in self._entryLines:
tor-commits@lists.torproject.org