Permalink
Browse files

[Sanity] Refactor

A refactor that moves shared code and vendor code
to separate folders, and also removes code duplication
between the Mac client and the iPhone client.
This also gives a much cleaner abstraction between
code that handles view drawing and the socket
and measurment.
  • Loading branch information...
1 parent a084f52 commit 410d9f56b491047ebd6f2749361851882127c21f @sebastian committed May 18, 2012
Showing with 791 additions and 29,168 deletions.
  1. +0 −1 {SignpostDemoServer/SignpostDemoServer → SharedCode}/ServerSocketHandler.h
  2. 0 {SignpostDemoServer/SignpostDemoServer → SharedCode}/ServerSocketHandler.m
  3. 0 {SignpostDemoServer/SignpostDemoServer → SharedCode}/SharedCode.h
  4. 0 {SignpostDemoServer/SignpostDemoServer → SharedCode}/SharedCode.m
  5. +73 −0 SharedCode/SocketHandler.h
  6. +321 −0 SharedCode/SocketHandler.m
  7. BIN SignpostDemo.xcworkspace/xcuserdata/spe24.xcuserdatad/UserInterfaceState.xcuserstate
  8. +32 −32 SignpostDemoClient/SignpostDemoClient.xcodeproj/project.pbxproj
  9. +4 −29 SignpostDemoClient/SignpostDemoClient/AppDelegate.h
  10. +48 −300 SignpostDemoClient/SignpostDemoClient/AppDelegate.m
  11. +212 −225 SignpostDemoServer/SignpostDemoServer.xcodeproj/project.pbxproj
  12. +0 −1,044 SignpostDemoServer/SignpostDemoServer/GCDAsyncSocket.h
  13. +0 −7,096 SignpostDemoServer/SignpostDemoServer/GCDAsyncSocket.m
  14. +0 −849 SignpostDemoServer/SignpostDemoServer/GCDAsyncUdpSocket.h
  15. +0 −5,112 SignpostDemoServer/SignpostDemoServer/GCDAsyncUdpSocket.m
  16. +43 −28 SignpostDemoiPhone/SignpostDemoiPhone.xcodeproj/project.pbxproj
  17. +0 −1,044 SignpostDemoiPhone/SignpostDemoiPhone/GCDAsyncSocket.h
  18. +0 −7,096 SignpostDemoiPhone/SignpostDemoiPhone/GCDAsyncSocket.m
  19. +0 −849 SignpostDemoiPhone/SignpostDemoiPhone/GCDAsyncUdpSocket.h
  20. +0 −5,112 SignpostDemoiPhone/SignpostDemoiPhone/GCDAsyncUdpSocket.m
  21. +2 −31 SignpostDemoiPhone/SignpostDemoiPhone/ViewController.h
  22. +56 −320 SignpostDemoiPhone/SignpostDemoiPhone/ViewController.m
  23. 0 {SignpostDemoClient/SignpostDemoClient → Vendor/CocoaAsyncSocket}/GCDAsyncSocket.h
  24. 0 {SignpostDemoClient/SignpostDemoClient → Vendor/CocoaAsyncSocket}/GCDAsyncSocket.m
  25. 0 {SignpostDemoClient/SignpostDemoClient → Vendor/CocoaAsyncSocket}/GCDAsyncUdpSocket.h
  26. 0 {SignpostDemoClient/SignpostDemoClient → Vendor/CocoaAsyncSocket}/GCDAsyncUdpSocket.m
  27. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Categories/DDData.h
  28. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Categories/DDData.m
  29. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Categories/DDNumber.h
  30. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Categories/DDNumber.m
  31. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Categories/DDRange.h
  32. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Categories/DDRange.m
  33. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPAuthenticationRequest.h
  34. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPAuthenticationRequest.m
  35. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPConnection.h
  36. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPConnection.m
  37. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPLogging.h
  38. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPMessage.h
  39. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPMessage.m
  40. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPResponse.h
  41. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPServer.h
  42. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/HTTPServer.m
  43. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Mime/MultipartFormDataParser.h
  44. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Mime/MultipartFormDataParser.m
  45. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Mime/MultipartMessageHeader.h
  46. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Mime/MultipartMessageHeader.m
  47. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Mime/MultipartMessageHeaderField.h
  48. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Mime/MultipartMessageHeaderField.m
  49. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/NetworkData.h
  50. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/NetworkData.m
  51. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/PacketHelper.h
  52. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/PacketHelper.m
  53. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPAsyncFileResponse.h
  54. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPAsyncFileResponse.m
  55. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPDataResponse.h
  56. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPDataResponse.m
  57. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPDynamicFileResponse.h
  58. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPDynamicFileResponse.m
  59. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPFileResponse.h
  60. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPFileResponse.m
  61. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPRedirectResponse.h
  62. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/Responses/HTTPRedirectResponse.m
  63. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/WebSocket.h
  64. 0 {SignpostDemoServer/SignpostDemoServer → Vendor/CocoaHTTPServer}/WebSocket.m
  65. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/About.txt
  66. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDASLLogger.h
  67. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDASLLogger.m
  68. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDAbstractDatabaseLogger.h
  69. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDAbstractDatabaseLogger.m
  70. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDFileLogger.h
  71. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDFileLogger.m
  72. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDLog.h
  73. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDLog.m
  74. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDTTYLogger.h
  75. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/DDTTYLogger.m
  76. 0 ...ostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/Extensions/ContextFilterLogFormatter.h
  77. 0 ...ostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/Extensions/ContextFilterLogFormatter.m
  78. 0 ...ostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.h
  79. 0 ...ostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/Extensions/DispatchQueueLogFormatter.m
  80. 0 {SignpostDemoServer/SignpostDemoServer → Vendor}/CocoaLumberjack/Extensions/README.txt
@@ -42,7 +42,6 @@ typedef void(^JitterUpdatesCallback)(double, double);
}
- (id)initWithLogHandlerMessage:(LogHandler)message logHandlerError:(LogHandler)error logHandlerInfo:(LogHandler)info;
-
- (void)setJitterCallbackUpdate:(JitterUpdatesCallback)callback;
// Returns YES if is running as a result, and NO if it isn't.
View
@@ -0,0 +1,73 @@
+//
+// SocketHandler.h
+// SignpostDemoClient
+//
+// Created by Sebastian Eide on 18/05/2012.
+// Copyright (c) 2012 Kle.io. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+
+typedef void(^ControlsToggle)(BOOL);
+typedef void(^LogHandler)(NSString *);
+// The block is called with jitterSeenLocally, jitterSeenByServer
+typedef void(^JitterUpdatesCallback)(double, double);
+// Called with downstream bandwidth, client latency, upstream bandwidth, server latency
+typedef void(^GoodputLatency)(double, double, double, double);
+
+@class GCDAsyncSocket;
+@class GCDAsyncUdpSocket;
+@class SharedCode;
+
+@interface SocketHandler : NSObject
+{
+ // Latency and goodput
+ dispatch_queue_t socketQueue;
+ GCDAsyncSocket *socket;
+
+ // Jitter
+ dispatch_queue_t jitterSocketQueue;
+ GCDAsyncUdpSocket *jitterSocket;
+
+ // General bookkeeping
+ BOOL isConnected;
+
+ SharedCode *commonFunc;
+
+ // For calculating jitter
+ NSUInteger serverJitterPort;
+ NSMutableArray *interarrivalTimesOfJitterMessages;
+ NSDate *lastReceivedMessage;
+
+ // The jitter seen by the server
+ double serverJitter;
+ NSString *serverhost;
+
+ // Goodput
+ double downstreamBandwidth;
+ double upstreamBandwidth;
+
+ // Latency
+ double clientLatency;
+ double serverLatency;
+
+ // Timers for latency and bandwidth measurements
+ NSDate *startTimerLatency, *startTimerBandwidth;
+
+ LogHandler callbackLogMessage;
+ LogHandler callbackLogError;
+ LogHandler callbackLogInfo;
+ JitterUpdatesCallback jitterUpdatesCallback;
+ ControlsToggle controlsToggleCallback;
+ GoodputLatency goodputLatencyCallback;
+}
+
+- (id)initWithLogHandlerMessage:(LogHandler)message logHandlerError:(LogHandler)error logHandlerInfo:(LogHandler)info;
+- (void)setJitterCallbackUpdate:(JitterUpdatesCallback)callback;
+- (void)setControlsToggleCallback:(ControlsToggle)callback;
+- (void)setGoodputLatencyCallback:(GoodputLatency)callback;
+
+- (void)startStopSocketForHost:(NSString*)host port:(NSUInteger)port;
+- (void) startPingPangPongData;
+
+@end
Oops, something went wrong.

0 comments on commit 410d9f5

Please sign in to comment.