aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Database/Realtime
diff options
context:
space:
mode:
authorGravatar Paul Beusterien <paulbeusterien@google.com>2017-06-30 10:47:37 -0700
committerGravatar VinayGuthal <vinayg@qhode.com>2017-06-30 13:47:37 -0400
commitddbfd4cc666f5227ab0e1f5a98c8a499ccbb32d1 (patch)
tree9c2ec4e15b6741f413d66f428c45f0278219d728 /Firebase/Database/Realtime
parent925f4c8b7558373172dd9410b7844637afaa2424 (diff)
Add travis trailing whitespace check (#116)
* Add travis trailing whitespace check * Remove trailing white space
Diffstat (limited to 'Firebase/Database/Realtime')
-rw-r--r--Firebase/Database/Realtime/FConnection.m16
-rw-r--r--Firebase/Database/Realtime/FWebSocketConnection.m30
2 files changed, 23 insertions, 23 deletions
diff --git a/Firebase/Database/Realtime/FConnection.m b/Firebase/Database/Realtime/FConnection.m
index 1550bfc..53f434c 100644
--- a/Firebase/Database/Realtime/FConnection.m
+++ b/Firebase/Database/Realtime/FConnection.m
@@ -67,13 +67,13 @@ typedef enum {
if (state != REALTIME_STATE_DISCONNECTED) {
FFLog(@"I-RDB082002", @"Closing realtime connection.");
state = REALTIME_STATE_DISCONNECTED;
-
+
if (self.conn) {
FFLog(@"I-RDB082003", @"Calling close again.");
[self.conn close];
self.conn = nil;
}
-
+
[self.delegate onDisconnect:self withReason:reason];
}
}
@@ -123,7 +123,7 @@ typedef enum {
} else if (state == REALTIME_STATE_CONNECTED) {
FFLog(@"I-RDB082007", @"Realtime connection lost.");
}
-
+
[self close];
}
@@ -138,7 +138,7 @@ typedef enum {
[self onControl:[message objectForKey:kFWPAsyncServerEnvelopeData]];
}
else {
- FFLog(@"I-RDB082008", @"Unrecognized server packet type: %@", rawMessageType);
+ FFLog(@"I-RDB082008", @"Unrecognized server packet type: %@", rawMessageType);
}
}
else {
@@ -174,7 +174,7 @@ typedef enum {
- (void) onConnectionShutdownWithReason:(NSString *)reason {
FFLog(@"I-RDB082013", @"Connection shutdown command received. Shutting down...");
-
+
[self.delegate onKill:self withReason:reason];
[self close];
}
@@ -184,9 +184,9 @@ typedef enum {
// NSString* version = [handshake objectForKey:kFWPAsyncServerHelloVersion];
NSString* host = [handshake objectForKey:kFWPAsyncServerHelloConnectedHost];
NSString* sessionID = [handshake objectForKey:kFWPAsyncServerHelloSession];
-
+
self.repoInfo.internalHost = host;
-
+
if (state == REALTIME_STATE_CONNECTING) {
[self.conn start];
[self onConnection:self.conn readyAtTime:timestamp sessionID:sessionID];
@@ -196,7 +196,7 @@ typedef enum {
- (void) onConnection:(FWebSocketConnection *)conn readyAtTime:(NSNumber *)timestamp sessionID:(NSString *)sessionID {
FFLog(@"I-RDB082014", @"Realtime connection established");
state = REALTIME_STATE_CONNECTED;
-
+
[self.delegate onReady:self atTime:timestamp sessionID:sessionID];
}
diff --git a/Firebase/Database/Realtime/FWebSocketConnection.m b/Firebase/Database/Realtime/FWebSocketConnection.m
index c4ead9e..5cd8bb0 100644
--- a/Firebase/Database/Realtime/FWebSocketConnection.m
+++ b/Firebase/Database/Realtime/FWebSocketConnection.m
@@ -65,11 +65,11 @@
self.totalFrames = 0;
self.dispatchQueue = queue;
frame = nil;
-
+
NSString* connectionUrl = [repoInfo connectionURLWithLastSessionID:lastSessionID];
NSString* ua = [self userAgent];
FFLog(@"I-RDB083001", @"(wsc:%@) Connecting to: %@ as %@", self.connectionId, connectionUrl, ua);
-
+
NSURLRequest* req = [[NSURLRequest alloc] initWithURL:[[NSURL alloc] initWithString:connectionUrl]];
self.webSocket = [[FSRWebSocket alloc] initWithURLRequest:req queue:queue andUserAgent:ua];
[self.webSocket setDelegateDispatchQueue:queue];
@@ -82,7 +82,7 @@
NSString* systemVersion;
NSString* deviceName;
BOOL hasUiDeviceClass = NO;
-
+
// Targetted compilation is ONLY for testing. UIKit is weak-linked in actual release build.
#if TARGET_OS_IOS
Class uiDeviceClass = NSClassFromString(@"UIDevice");
@@ -92,7 +92,7 @@
hasUiDeviceClass = YES;
}
#endif
-
+
if (!hasUiDeviceClass) {
NSDictionary *systemVersionDictionary = [NSDictionary dictionaryWithContentsOfFile:@"/System/Library/CoreServices/SystemVersion.plist"];
systemVersion = [systemVersionDictionary objectForKey:@"ProductVersion"];
@@ -143,19 +143,19 @@
[self resetKeepAlive];
- NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dictionary
+ NSData* jsonData = [NSJSONSerialization dataWithJSONObject:dictionary
options:kNilOptions error:nil];
-
+
NSString* data = [[NSString alloc] initWithData:jsonData
encoding:NSUTF8StringEncoding];
-
+
NSArray* dataSegs = [FUtilities splitString:data intoMaxSize:kWebsocketMaxFrameSize];
// First send the header so the server knows how many segments are forthcoming
if (dataSegs.count > 1) {
[self.webSocket send:[NSString stringWithFormat:@"%u", (unsigned int)dataSegs.count]];
}
-
+
// Then, actually send the segments.
for(NSString * segment in dataSegs) {
[self.webSocket send:segment];
@@ -165,7 +165,7 @@
- (void) nop:(NSTimer *)timer {
if (!isClosed) {
FFLog(@"I-RDB083004", @"(wsc:%@) nop", self.connectionId);
- [self.webSocket send:@"0"];
+ [self.webSocket send:@"0"];
}
else {
FFLog(@"I-RDB083005", @"(wsc:%@) No more websocket; invalidating nop timer.", self.connectionId);
@@ -202,7 +202,7 @@
error:nil];
frame = nil;
FFLog(@"I-RDB083007", @"(wsc:%@) handleIncomingFrame sending complete frame: %d", self.connectionId, self.totalFrames);
-
+
@autoreleasepool {
[self.delegate onMessage:self withMessage:json];
}
@@ -231,9 +231,9 @@
- (void)webSocketDidOpen:(FSRWebSocket *)webSocket
{
FFLog(@"I-RDB083008", @"(wsc:%@) webSocketDidOpen", self.connectionId);
-
+
everConnected = YES;
-
+
dispatch_async(dispatch_get_main_queue(), ^{
self->keepAlive = [NSTimer scheduledTimerWithTimeInterval:kWebsocketKeepaliveInterval
target:self
@@ -261,8 +261,8 @@
/**
* Note that the close / onClosed / shutdown cycle here is a little different from the javascript client.
- * In order to properly handle deallocation, no close-related action is taken at a higher level until we
- * have received notification from the websocket itself that it is closed. Otherwise, we end up deallocating
+ * In order to properly handle deallocation, no close-related action is taken at a higher level until we
+ * have received notification from the websocket itself that it is closed. Otherwise, we end up deallocating
* this class and the FConnection class before the websocket has a change to call some of its delegate methods.
* So, since close is the external close handler, we just set a flag saying not to call our own delegate method
* and close the websocket. That will trigger a callback into this class that can then do things like clean up
@@ -278,7 +278,7 @@
- (void) shutdown {
isClosed = YES;
-
+
// Call delegate methods
[self.delegate onDisconnect:self wasEverConnected:everConnected];