Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#6249 closed enhancement (fixed)

Show amount of traffic in connections list in Network Map window.

Reported by: cypherpunks Owned by: chiiph
Priority: Low Milestone:
Component: Archived/Vidalia Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: Points:
Reviewer: Sponsor:

Description

I thought it would be a nice feature if the connections list in the Network Map window showed the traffic amounts used by each connection. Since people using Tor are plenty paranoid, it would be reassuring to be able to keep an eye on it. For example, one can easily see the difference between an HTTP keep-alive connection and an active flow of data, and watch the progress of a file upload (since web sites usually can't provide that info, especially with JavaScript off). It might also encourage people to be more mindful of their data usage. (Personally I keep the Network Map open because I find its information useful, but I never open the Bandwidth Graph.)

Since I've wanted this feature myself for a while, I thought I should try to write it myself. My C++ is rusty and I don't know Qt so this was hard, but it works great.

I've only modified Vidalia, not Tor itself or its control protocol, so there are some small caveats here:

  • The STREAM_BW messages emitted by Tor are traffic delta values rather than totals, so Vidalia cannot count stream traffic from before it was started.
  • Seemingly it counts the traffic sent over the logical TCP stream, but not the overhead of the stream itself, which may or may not be desirable, but it's worth noting that it's not the same as the bandwidth graph.
  • It does not count the traffic of circuits because there is no message for that in the control protocol.

I made a patch against Vidalia 0.2.20 that I got from the git web thingy. I'm bad with version control software and with diffs and patches, so please bear with me if I need to submit this in a different format or to somewhere else. But if someone in charge would be so kind as to verify it, and like it, and commit it in some fashion (modified or otherwise), it would make my day.

The attached patch also fixes the Stream::isValidStreamId function, because while I was doing this I noticed that function didn't work.

Child Tickets

Attachments (2)

TrafficColumn.png (5.9 KB) - added by cypherpunks 7 years ago.
TrafficColumn.patch (14.8 KB) - added by cypherpunks 7 years ago.

Download all attachments as: .zip

Change History (6)

Changed 7 years ago by cypherpunks

Attachment: TrafficColumn.png added

comment:1 Changed 7 years ago by chiiph

Status: newneeds_revision

I like the idea. A couple of comments for your patch:

  • Why have you chosen to make the change in the if condition in Stream.cpp?
  • You should remove the commented emit LogMessage in TorEvents.cpp
  • The following if:
if (msg.size() >= 3) {

Should be:

if (msg.size() > 3) {

Otherwise if the msg.size() is == 3, then you can't access the 4th element.

  • In StreanItem.cpp, the _bytesReceived and _bytesSent initialization should be done as a part of the constructor init list.
  • Methods bytesReceived() and bytesSent() should be const.
  • You should upload a format-patch or a branch in some public git repo that I can merge, so you get credit for this patch.

Changed 7 years ago by cypherpunks

Attachment: TrafficColumn.patch added

comment:2 Changed 7 years ago by cypherpunks

Why have you chosen to make the change in the if condition in Stream.cpp?

I explained up above. The old condition was always false.

Should be:
if (msg.size() > 3) {

Oops, yeah.

In StreamItem.cpp, the _bytesReceived and _bytesSent initialization should be done as a part of the constructor init list.

Methods bytesReceived() and bytesSent() should be const.

Yup, yup. (Too much Java for me!) I attached a new patch.

I also decided against this line, because the B and KB are so easily confused at a glance on the short-lived connections:
if (bytes < 1 * K) return QString("%1 B").arg(bytes);

You should upload a format-patch or a branch in some public git repo that I can merge, so you get credit for this patch.

Haven't a clue how to do that and can't be bothered! :) You seem to know what you're doing. If you like it can you just patch it in somehow? I don't care about attribution. Public domain. Y'all can have it.

comment:3 Changed 7 years ago by chiiph

Resolution: fixed
Status: needs_revisionclosed

I've applied this to the alpha branch. It will be out 0.3.3-alpha.

comment:4 Changed 7 years ago by cypherpunks

Oh cool, thanks!

Keep up the good fight!

Note: See TracTickets for help on using tickets.