Skip to content

Commit

Permalink
Added labels down-right that display transfer amounts up/down
Browse files Browse the repository at this point in the history
  • Loading branch information
Edward Patel authored and tcurdt committed Jun 4, 2010
1 parent bca1d12 commit 96c4ec2
Show file tree
Hide file tree
Showing 6 changed files with 197 additions and 19 deletions.
33 changes: 29 additions & 4 deletions Frameworks/srelay-0.4.7p3/relay.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ int validate_access __P((char *, char *));
int set_sock_info __P((loginfo *, int, int));
void relay __P((int, int));
int log_transfer __P((loginfo *));
void upload_amount(ssize_t len);
void download_amount(ssize_t len);

/* Breakout functions to track relay amounts
void upload_amount(ssize_t len)
{
static ssize_t total_len = 0;
total_len += len;
}
void download_amount(ssize_t len)
{
static ssize_t total_len = 0;
total_len += len;
}
*/

void readn(rlyinfo *ri)
{
Expand Down Expand Up @@ -222,33 +239,41 @@ void relay(int cs, int ss)
ri.from = ss; ri.to = cs; ri.oob = 0;
if ((wc = forward(&ri)) <= 0)
done++;
else
else {
li.bc += wc; li.dnl += wc;
download_amount(wc);
}

FD_CLR(ss, &rfds);
}
if (FD_ISSET(ss, &xfds)) {
ri.from = ss; ri.to = cs; ri.oob = 1;
if ((wc = forward(&ri)) <= 0)
done++;
else
else {
li.bc += wc; li.dnl += wc;
download_amount(wc);
}
FD_CLR(ss, &xfds);
}
if (FD_ISSET(cs, &rfds)) {
ri.from = cs; ri.to = ss; ri.oob = 0;
if ((wc = forward(&ri)) <= 0)
done++;
else
else {
li.bc += wc; li.upl += wc;
upload_amount(wc);
}
FD_CLR(cs, &rfds);
}
if (FD_ISSET(cs, &xfds)) {
ri.from = cs; ri.to = ss; ri.oob = 1;
if ((wc = forward(&ri)) <= 0)
done++;
else
else {
li.bc += wc; li.upl += wc;
upload_amount(wc);
}
FD_CLR(cs, &xfds);
}
if (done > 0)
Expand Down
136 changes: 124 additions & 12 deletions Resources/StatusViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">784</int>
<string key="IBDocument.SystemVersion">10C540</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.25</string>
<string key="IBDocument.HIToolboxVersion">458.00</string>
<string key="IBDocument.SystemVersion">10D573</string>
<string key="IBDocument.InterfaceBuilderVersion">762</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">460.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string key="NS.object.0">62</string>
<string key="NS.object.0">87</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="20"/>
<integer value="6"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand All @@ -31,9 +31,11 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBProxyObject" id="372490531">
<string key="IBProxiedObjectIdentifier">IBFilesOwner</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBProxyObject" id="843779117">
<string key="IBProxiedObjectIdentifier">IBFirstResponder</string>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
<object class="IBUIView" id="774585933">
<reference key="NSNextResponder"/>
Expand All @@ -48,6 +50,7 @@
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<int key="IBUIContentMode">4</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSCustomResource" key="IBUIImage">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">Status.png</string>
Expand All @@ -65,6 +68,7 @@
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">192.168.1.10</string>
<object class="NSColor" key="IBUITextColor" id="157006074">
<int key="NSColorSpace">1</int>
Expand All @@ -84,6 +88,7 @@
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">8888</string>
<reference key="IBUITextColor" ref="157006074"/>
<nil key="IBUIHighlightedColor"/>
Expand All @@ -100,6 +105,7 @@
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">Port:</string>
<reference key="IBUITextColor" ref="157006074"/>
<nil key="IBUIHighlightedColor"/>
Expand All @@ -115,6 +121,7 @@
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">IP Address:</string>
<reference key="IBUITextColor" ref="157006074"/>
<nil key="IBUIHighlightedColor"/>
Expand All @@ -129,6 +136,7 @@
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIBounces">NO</bool>
<bool key="IBUIScrollEnabled">NO</bool>
<bool key="IBUIShowsHorizontalScrollIndicator">NO</bool>
Expand All @@ -145,16 +153,18 @@
</object>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIAutocapitalizationType">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBUITextView" id="45349635">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">292</int>
<string key="NSFrame">{{71, 396}, {229, 49}}</string>
<string key="NSFrame">{{71, 391}, {229, 49}}</string>
<reference key="NSSuperview" ref="774585933"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<bool key="IBUIMultipleTouchEnabled">YES</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<bool key="IBUIBounces">NO</bool>
<bool key="IBUIScrollEnabled">NO</bool>
<bool key="IBUIShowsHorizontalScrollIndicator">NO</bool>
Expand All @@ -175,6 +185,7 @@
</object>
<object class="IBUITextInputTraits" key="IBUITextInputTraits">
<int key="IBUIAutocapitalizationType">2</int>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBUIButton" id="128279814">
Expand All @@ -184,6 +195,7 @@
<reference key="NSSuperview" ref="774585933"/>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<int key="IBUIContentHorizontalAlignment">0</int>
<int key="IBUIContentVerticalAlignment">0</int>
<object class="NSFont" key="IBUIFont">
Expand All @@ -203,6 +215,64 @@
<bytes key="NSWhite">MC41AA</bytes>
</object>
</object>
<object class="IBUILabel" id="624405585">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{87, 424}, {223, 16}}</string>
<reference key="NSSuperview" ref="774585933"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MCAwIDAgMAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">0 ↑</string>
<object class="NSFont" key="IBUIFont" id="673283836">
<string key="NSName">Verdana</string>
<double key="NSSize">11</double>
<int key="NSfFlags">16</int>
</object>
<object class="NSColor" key="IBUITextColor" id="686256370">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEAA</bytes>
</object>
<object class="NSColor" key="IBUIHighlightedColor" id="670896196">
<int key="NSColorSpace">1</int>
<bytes key="NSRGB">MSAxIDEgMAA</bytes>
</object>
<string key="IBUIShadowOffset">{0, 0}</string>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
<int key="IBUILineBreakMode">1</int>
</object>
<object class="IBUILabel" id="782586787">
<reference key="NSNextResponder" ref="774585933"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{87, 437}, {223, 16}}</string>
<reference key="NSSuperview" ref="774585933"/>
<object class="NSColor" key="IBUIBackgroundColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MCAwAA</bytes>
</object>
<bool key="IBUIOpaque">NO</bool>
<bool key="IBUIClipsSubviews">YES</bool>
<int key="IBUIContentMode">7</int>
<bool key="IBUIUserInteractionEnabled">NO</bool>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
<string key="IBUIText">0 ↓</string>
<reference key="IBUIFont" ref="673283836"/>
<reference key="IBUITextColor" ref="686256370"/>
<reference key="IBUIHighlightedColor" ref="670896196"/>
<string key="IBUIShadowOffset">{0, 0}</string>
<int key="IBUIBaselineAdjustment">1</int>
<float key="IBUIMinimumFontSize">10</float>
<int key="IBUITextAlignment">2</int>
<int key="IBUILineBreakMode">1</int>
</object>
</object>
<string key="NSFrameSize">{320, 460}</string>
<reference key="NSSuperview"/>
Expand All @@ -212,6 +282,7 @@
</object>
<bool key="IBUIClearsContextBeforeDrawing">NO</bool>
<object class="IBUISimulatedStatusBarMetrics" key="IBUISimulatedStatusBarMetrics"/>
<string key="targetRuntimeIdentifier">IBCocoaTouchFramework</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
Expand Down Expand Up @@ -250,6 +321,22 @@
</object>
<int key="connectionID">21</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">uploadLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="624405585"/>
</object>
<int key="connectionID">24</int>
</object>
<object class="IBConnectionRecord">
<object class="IBCocoaTouchOutletConnection" key="connection">
<string key="label">downloadLabel</string>
<reference key="source" ref="372490531"/>
<reference key="destination" ref="782586787"/>
</object>
<int key="connectionID">25</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
Expand All @@ -276,14 +363,16 @@
<reference key="object" ref="774585933"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="391037107"/>
<reference ref="79676381"/>
<reference ref="988302108"/>
<reference ref="1057681166"/>
<reference ref="514428748"/>
<reference ref="53937794"/>
<reference ref="45349635"/>
<reference ref="128279814"/>
<reference ref="391037107"/>
<reference ref="624405585"/>
<reference ref="782586787"/>
<reference ref="45349635"/>
</object>
<reference key="parent" ref="0"/>
</object>
Expand Down Expand Up @@ -327,6 +416,16 @@
<reference key="object" ref="128279814"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">22</int>
<reference key="object" ref="624405585"/>
<reference key="parent" ref="774585933"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">23</int>
<reference key="object" ref="782586787"/>
<reference key="parent" ref="774585933"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
Expand All @@ -341,6 +440,8 @@
<string>17.IBPluginDependency</string>
<string>19.IBPluginDependency</string>
<string>20.IBPluginDependency</string>
<string>22.IBPluginDependency</string>
<string>23.IBPluginDependency</string>
<string>6.IBEditorWindowLastContentRect</string>
<string>6.IBPluginDependency</string>
<string>8.IBPluginDependency</string>
Expand All @@ -356,7 +457,9 @@
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>{{856, 377}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>{{350, 376}, {320, 480}}</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
<string>com.apple.InterfaceBuilder.IBCocoaTouchPlugin</string>
Expand All @@ -378,7 +481,7 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">21</int>
<int key="maxID">25</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand All @@ -394,13 +497,17 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>downloadLabel</string>
<string>ipLabel</string>
<string>portLabel</string>
<string>uploadLabel</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>UILabel</string>
<string>UILabel</string>
<string>UILabel</string>
<string>UILabel</string>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
Expand Down Expand Up @@ -647,6 +754,7 @@
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaTouchFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaTouchPlugin.iPhoneOS</string>
<integer value="784" key="NS.object.0"/>
Expand All @@ -658,6 +766,10 @@
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../iProxy.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
<string key="IBCocoaTouchPluginVersion">3.1</string>
<object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
<string key="NS.key.0">Status.png</string>
<string key="NS.object.0">{320, 460}</string>
</object>
<string key="IBCocoaTouchPluginVersion">87</string>
</data>
</archive>
3 changes: 3 additions & 0 deletions Sources/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,8 @@
@property (nonatomic, retain) UIWindow *window;
@property (nonatomic, retain) StatusViewController *statusViewController;

- (void)setUploadLabel:(NSNumber*)amount;
- (void)setDownloadLabel:(NSNumber*)amount;

@end

Loading

0 comments on commit 96c4ec2

Please sign in to comment.