Skip to content
Browse files

Added the ability for clients to deregister themselves without being …

…connected to the server. Clients will intelligently deregister with previous servers the next time they are discovered

Logging verbosity++ on the client side
  • Loading branch information...
1 parent 3a06307 commit 280826d05ac1fe0ad21d3b67a7a05c0004f329cc Michael Fey committed Aug 18, 2010
Showing with 184 additions and 28 deletions.
  1. +25 −0 DesktopCode/ZSyncConnectionDelegate.m
  2. +25 −24 DeviceCode/ZSyncTouchHandler.h
  3. +131 −2 DeviceCode/ZSyncTouchHandler.m
  4. +3 −2 SharedCode/ZSyncShared.h
View
25 DesktopCode/ZSyncConnectionDelegate.m
@@ -201,6 +201,26 @@ - (void)deregisterSyncClient:(BLIPRequest *)request
[response send];
}
+- (void)deregisterLatentSyncClient:(BLIPRequest *)request
+{
+ DLog(@"%s", __PRETTY_FUNCTION__);
+ NSString *clientID = [request bodyString];
+ DLog(@"%s clientID %@", __PRETTY_FUNCTION__, clientID);
+ // TODO: Compare version numbers
+ ZAssert(clientID != nil, @"Body string is nil in request\n%@", [[request properties] allProperties]);
+
+ BLIPResponse *response = [request response];
+ [response setValue:zsActID(zsActionLatentDeregisterClient) ofProperty:zsAction];
+ [response setValue:[[NSUserDefaults standardUserDefaults] valueForKey:zsServerUUID] ofProperty:zsServerUUID];
+
+ ISyncClient *syncClient = [[ISyncManager sharedManager] clientWithIdentifier:clientID];
+ if (syncClient) {
+ [[ISyncManager sharedManager] unregisterClient:syncClient];
+ }
+
+ [response send];
+}
+
- (BOOL)verifySchema:(BLIPRequest *)request
{
DLog(@"%s", __PRETTY_FUNCTION__);
@@ -428,6 +448,11 @@ - (BOOL)connection:(BLIPConnection *)connection receivedRequest:(BLIPRequest *)r
NSInteger action = [[[request properties] valueOfProperty:zsAction] integerValue];
BLIPResponse *response = [request response];
switch (action) {
+ case zsActionLatentDeregisterClient:
+ DLog(@"%s zsActionLatentDeregisterClient", __PRETTY_FUNCTION__);
+ [self deregisterLatentSyncClient:request];
+ return YES;
+
case zsActionDeregisterClient:
DLog(@"%s zsActionDeregisterClient", __PRETTY_FUNCTION__);
[self deregisterSyncClient:request];
View
49 DeviceCode/ZSyncTouchHandler.h
@@ -26,8 +26,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
// OTHER DEALINGS IN THE SOFTWARE.
-#import "ZSyncShared.h"
#import "ServerBrowserDelegate.h"
+#import "ZSyncShared.h"
@class ZSyncTouchHandler;
@class ServerBrowser;
@@ -45,83 +45,84 @@
@end
-@protocol ZSyncDelegate
+@protocol ZSyncDelegate
@required
/* Notification that the server has accepted the device and is awaiting
* a pairing code to be sent back. The pairing code will be displayed
* on the server.
*/
-- (void)zSyncHandler:(ZSyncTouchHandler*)handler displayPairingCode:(NSString*)passcode;
+- (void)zSyncHandler:(ZSyncTouchHandler *)handler displayPairingCode:(NSString *)passcode;
/* The pairing code has been entered correctly on the server. The client should
* dismiss the code display at this time.
*/
-- (void)zSyncPairingCodeCompleted:(ZSyncTouchHandler*)handler;
+- (void)zSyncPairingCodeCompleted:(ZSyncTouchHandler *)handler;
/* The pairing code was entered incorrectly too many times so everything resets.
* The user can select the server again or try another server.
*/
-- (void)zSyncPairingCodeRejected:(ZSyncTouchHandler*)handler;
+- (void)zSyncPairingCodeRejected:(ZSyncTouchHandler *)handler;
-/* The pairing code window was cancelled on the server or the connection to the
- * server was severed. The client should dismiss the code display at this time.
+/* The pairing code window was cancelled on the server or the connection to the
+ * server was severed. The client should dismiss the code display at this time.
*/
-- (void)zSyncPairingCodeCancelled:(ZSyncTouchHandler*)handler;
+- (void)zSyncPairingCodeCancelled:(ZSyncTouchHandler *)handler;
/* This is an information message to indicate that a sync has finished.
* The application should at this point refresh all displays from the NSManagedObjectContext
*/
-- (void)zSyncFinished:(ZSyncTouchHandler*)handler;
+- (void)zSyncFinished:(ZSyncTouchHandler *)handler;
/* This is an information message to indicate that a sync has begun.
* This is a good place to presenta dialog and pop the UI back to its root
*/
-- (void)zSyncStarted:(ZSyncTouchHandler*)handler;
+- (void)zSyncStarted:(ZSyncTouchHandler *)handler;
/* This message is sent when a list of servers has been created and there is
- * no server currently paired. It is expected that the app will present a
+ * no server currently paired. It is expected that the app will present a
* list of servers or optionally request pairing automatically
*/
-- (void)zSyncNoServerPaired:(NSArray*)availableServers;
+- (void)zSyncNoServerPaired:(NSArray *)availableServers;
@optional
/* This message will be sent after a successful deregister.
* ZSync will not remove the data local to the device.
*/
-- (void)zSyncDeregisterComplete:(ZSyncTouchHandler*)handler;
+- (void)zSyncDeregisterComplete:(ZSyncTouchHandler *)handler;
/* This message can be sent at any time when an error occurred. The description
* will be populated with information about the failure.
*/
-- (void)zSync:(ZSyncTouchHandler*)handler errorOccurred:(NSError*)error;
+- (void)zSync:(ZSyncTouchHandler *)handler errorOccurred:(NSError *)error;
/* This is an information message letting the application know that the server
* either selected or previously paired with can no longer talk to this version
* of the touch code. The user should be notified of this and know that syncing
* is currently unavailable
*/
-- (void)zSync:(ZSyncTouchHandler*)handler serverVersionUnsupported:(NSError*)error;
+- (void)zSync:(ZSyncTouchHandler *)handler serverVersionUnsupported:(NSError *)error;
-/* The data file transfer (from the server) has started. This is for
+/* The data file transfer (from the server) has started. This is for
* information purposes only and does not require any action by the app.
*/
-- (void)zSyncFileDownloadStarted:(ZSyncTouchHandler*)handler;
+- (void)zSyncFileDownloadStarted:(ZSyncTouchHandler *)handler;
/* This is a information message indicating that the previously paired
* server cannot be located. The app can now request a list of other servers
* to let the user change what server is paird.
*/
-- (void)zSyncServerUnavailable:(ZSyncTouchHandler*)handler;
+- (void)zSyncServerUnavailable:(ZSyncTouchHandler *)handler;
@end
typedef enum {
ZSyncServerActionNoActivity = 0,
ZSyncServerActionSync,
- ZSyncServerActionDeregister
+ ZSyncServerActionDeregister,
+ ZSyncServerActionLatentDeregistration
} ZSyncServerAction;
@interface ZSyncTouchHandler : NSObject <BLIPConnectionDelegate, ServerBrowserDelegate, NSNetServiceDelegate>
@@ -145,7 +146,7 @@ typedef enum {
id _delegate;
/* We are going to start off by trying to swap out the persistent stores
- * internally. If this goes badly then we can had it back out to the
+ * internally. If this goes badly then we can had it back out to the
* application instead.
*/
NSPersistentStoreCoordinator *_persistentStoreCoordinator;
@@ -171,12 +172,12 @@ typedef enum {
*/
+ (id)shared;
-- (void)registerDelegate:(id<ZSyncDelegate>)delegate withPersistentStoreCoordinator:(NSPersistentStoreCoordinator*)coordinator;
+- (void)registerDelegate:(id<ZSyncDelegate>)delegate withPersistentStoreCoordinator:(NSPersistentStoreCoordinator *)coordinator;
- (void)requestSync;
- (void)stopRequestingSync;
-- (void)requestPairing:(ZSyncService*)server;
-- (void)authenticatePairing:(NSString*)code;
+- (void)requestPairing:(ZSyncService *)server;
+- (void)authenticatePairing:(NSString *)code;
- (void)cancelPairing;
- (void)disconnectPairing;
@@ -186,6 +187,6 @@ typedef enum {
*/
- (void)deregister;
-- (NSString*)serverName;
+- (NSString *)serverName;
@end
View
133 DeviceCode/ZSyncTouchHandler.m
@@ -77,12 +77,14 @@ + (id)shared;
- (void)registerDelegate:(id<ZSyncDelegate>)delegate withPersistentStoreCoordinator:(NSPersistentStoreCoordinator *)coordinator;
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
[self setDelegate:delegate];
[self setPersistentStoreCoordinator:coordinator];
}
- (void)requestSync
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
ZAssert([self serverAction] == ZSyncServerActionNoActivity, @"Attempt to sync while another action is active");
[self setServerAction:ZSyncServerActionSync];
@@ -95,14 +97,19 @@ - (void)requestSync
- (void)stopRequestingSync
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
[[self serviceBrowser] setDelegate:nil];
[[self serviceBrowser] stop];
[self setServerAction:ZSyncServerActionNoActivity];
}
- (void)requestPairing:(ZSyncService *)server
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
+
NSNetService *service = [server service];
+ [self setServerAction:ZSyncServerActionSync];
+
BLIPConnection *conn = [[BLIPConnection alloc] initToNetService:service];
[self setConnection:conn];
[conn setDelegate:self];
@@ -112,6 +119,7 @@ - (void)requestPairing:(ZSyncService *)server
- (void)authenticatePairing:(NSString *)code;
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
if (![self connection]) {
return;
}
@@ -137,6 +145,7 @@ - (void)authenticatePairing:(NSString *)code;
- (void)cancelPairing;
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
if (![self connection]) {
return;
}
@@ -162,6 +171,7 @@ - (void)cancelPairing;
- (void)disconnectPairing;
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
[[NSUserDefaults standardUserDefaults] removeObjectForKey:zsServerName];
[[NSUserDefaults standardUserDefaults] removeObjectForKey:zsServerUUID];
if ([self connection]) {
@@ -173,6 +183,7 @@ - (void)disconnectPairing;
- (void)deregister
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
DLog(@"deregister request received");
if ([self serverAction] != ZSyncServerActionNoActivity) {
@@ -207,6 +218,7 @@ - (void)deregister
- (NSString *)serverName
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
return [[NSUserDefaults standardUserDefaults] valueForKey:zsServerName];
}
@@ -215,6 +227,7 @@ - (NSString *)serverName
- (void)applicationWillTerminate:(NSNotification *)notification
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
DLog(@"closing connection");
if ([self connection]) {
[[self connection] close];
@@ -229,7 +242,38 @@ - (void)applicationWillTerminate:(NSNotification *)notification
- (void)networkTimeout:(NSTimer *)timer
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
DLog(@"timeout on local network");
+
+ if ([self serverAction] == ZSyncServerActionDeregister) {
+ DLog(@"[self serverAction] == ZSyncServerActionDeregister");
+ NSMutableArray *deregisteredServers = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:zsDeregisteredServersKey]];
+ if (!deregisteredServers) {
+ deregisteredServers = [[NSMutableArray alloc] init];
+ }
+
+ NSString *registeredServerUUID = [[NSUserDefaults standardUserDefaults] valueForKey:zsServerUUID];
+ if (registeredServerUUID) {
+ [deregisteredServers addObject:registeredServerUUID];
+ [[NSUserDefaults standardUserDefaults] setObject:deregisteredServers forKey:zsDeregisteredServersKey];
+ }
+
+ [[NSUserDefaults standardUserDefaults] setObject:nil forKey:zsServerUUID];
+ [[NSUserDefaults standardUserDefaults] setObject:nil forKey:zsServerName];
+ [[NSUserDefaults standardUserDefaults] synchronize];
+
+ [deregisteredServers release], deregisteredServers = nil;
+
+ networkTimer = nil;
+ [self setServerAction:ZSyncServerActionNoActivity];
+ if ([[self delegate] respondsToSelector:@selector(zSyncDeregisterComplete:)]) {
+ [[self delegate] zSyncDeregisterComplete:self];
+ }
+ [[timer userInfo] stopNotifer];
+
+ return;
+ }
+
networkTimer = nil;
[self setServerAction:ZSyncServerActionNoActivity];
if ([[self delegate] respondsToSelector:@selector(zSyncServerUnavailable:)]) {
@@ -240,6 +284,7 @@ - (void)networkTimeout:(NSTimer *)timer
- (void)reachabilityChanged:(NSNotification *)notification
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
Reachability *reachability = [notification object];
if ([reachability currentReachabilityStatus] == NotReachable) {
return;
@@ -264,6 +309,7 @@ - (void)reachabilityChanged:(NSNotification *)notification
- (NSString *)cachePath
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *filePath = [paths objectAtIndex:0];
@@ -272,6 +318,7 @@ - (NSString *)cachePath
- (void)startServerSearch
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
if ([self serviceBrowser]) {
DLog(@"service browser is not nil");
[[self serviceBrowser] setDelegate:nil];
@@ -314,6 +361,7 @@ - (void)startServerSearch
- (void)beginSyncWithService:(NSNetService *)service
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
BLIPConnection *conn = [[BLIPConnection alloc] initToNetService:service];
[self setConnection:conn];
[conn setDelegate:self];
@@ -323,6 +371,7 @@ - (void)beginSyncWithService:(NSNetService *)service
- (void)receiveFile:(BLIPRequest *)request
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
ZAssert([request complete], @"Message is incomplete");
DLog(@"file received");
@@ -356,6 +405,7 @@ - (void)receiveFile:(BLIPRequest *)request
- (BOOL)switchStore:(NSPersistentStore *)store withReplacement:(NSDictionary *)replacement error:(NSError **)error
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
NSDictionary *storeOptions = [[[store options] copy] autorelease];
NSFileManager *fileManager = [NSFileManager defaultManager];
NSPersistentStoreCoordinator *psc = [self persistentStoreCoordinator];
@@ -396,6 +446,7 @@ - (BOOL)switchStore:(NSPersistentStore *)store withReplacement:(NSDictionary *)r
- (void)completeSync
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
[[self persistentStoreCoordinator] lock];
// First we need to verify that we received every file. Otherwise we fail
@@ -461,6 +512,7 @@ - (void)completeSync
*/
- (void)startBrowser;
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
if (_serviceBrowser) {
return;
}
@@ -471,6 +523,7 @@ - (void)startBrowser;
- (void)sendUploadComplete
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
DLog(@"sending upload complete");
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init];
[dictionary setValue:zsActID(zsActionPerformSync) forKey:zsAction];
@@ -484,6 +537,7 @@ - (void)sendUploadComplete
- (void)uploadDataToServer;
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
[[self serviceBrowser] setDelegate:nil];
[[self serviceBrowser] stop];
[self setServiceBrowser:nil];
@@ -534,6 +588,7 @@ - (void)uploadDataToServer;
- (void)processTestFileTransfer:(BLIPRequest *)request
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
NSData *data = [request body];
DLog(@"length %i", [data length]);
NSString *path = [self cachePath];
@@ -552,6 +607,7 @@ - (void)processTestFileTransfer:(BLIPRequest *)request
- (NSString *)generatePairingCode
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
NSMutableString *string = [NSMutableString string];
[string appendFormat:@"%i", (arc4random() % 10)];
[string appendFormat:@"%i", (arc4random() % 10)];
@@ -563,6 +619,7 @@ - (NSString *)generatePairingCode
- (void)requestDeregistration;
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
DLog(@"issuing deregister command");
NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
[dictionary setValue:zsActID(zsActionDeregisterClient) forKey:zsAction];
@@ -577,9 +634,31 @@ - (void)requestDeregistration;
[[self connection] sendRequest:request];
}
+- (void)requestLatentDeregistration
+{
+ DLog(@"%s", __PRETTY_FUNCTION__);
+ NSMutableDictionary *dictionary = [NSMutableDictionary dictionary];
+ [dictionary setValue:zsActID(zsActionLatentDeregisterClient) forKey:zsAction];
+ NSString *schemaID = [[[NSBundle mainBundle] infoDictionary] objectForKey:zsSchemaIdentifier];
+ [dictionary setValue:schemaID forKey:zsSchemaIdentifier];
+
+ NSString *syncUUID = [[NSUserDefaults standardUserDefaults] valueForKey:zsSyncGUID];
+ DLog(@"%s syncUUID:%@", __PRETTY_FUNCTION__, syncUUID);
+
+ NSData *body = [syncUUID dataUsingEncoding:NSUTF8StringEncoding];
+
+ BLIPRequest *request = [BLIPRequest requestWithBody:body properties:dictionary];
+ [[self connection] sendRequest:request];
+}
+
- (void)connectionEstablished
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
switch ([self serverAction]) {
+ case ZSyncServerActionLatentDeregistration:
+ DLog(@"%s", __PRETTY_FUNCTION__);
+ [self requestLatentDeregistration];
+ break;
case ZSyncServerActionSync:
if ([[NSUserDefaults standardUserDefaults] valueForKey:zsServerUUID]) {
// Start a sync by pushing the data file to the server
@@ -623,6 +702,7 @@ - (void)connectionEstablished
- (NSMutableArray *)availableServers
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
if (!availableServers) {
availableServers = [[NSMutableArray alloc] init];
}
@@ -632,6 +712,7 @@ - (NSMutableArray *)availableServers
- (NSMutableArray *)discoveredServers
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
if (!discoveredServers) {
discoveredServers = [[NSMutableArray alloc] init];
}
@@ -641,6 +722,7 @@ - (NSMutableArray *)discoveredServers
- (NSObject *)lock
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
if (!lock) {
lock = [[NSObject alloc] init];
}
@@ -654,6 +736,7 @@ - (NSObject *)lock
- (void)updateServerList
{
[lock lock];
+ DLog(@"%s", __PRETTY_FUNCTION__);
[networkTimer invalidate], networkTimer = nil;
for (NSNetService *service in [self discoveredServers]) {
@@ -700,6 +783,7 @@ - (void)netServiceWillResolve:(NSNetService *)sender {}
*/
- (void)netServiceDidResolveAddress:(NSNetService *)bonjourService
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
NSString *registeredServerUUID = [[NSUserDefaults standardUserDefaults] valueForKey:zsServerUUID];
NSString *registeredServerName = [[NSUserDefaults standardUserDefaults] valueForKey:zsServerName];
@@ -718,13 +802,24 @@ - (void)netServiceDidResolveAddress:(NSNetService *)bonjourService
DLog(@"The TXT record did not contain a UUID.");
return;
}
+
NSString *incomingServerUUID = [[NSString alloc] initWithData:serverUUIDData encoding:NSUTF8StringEncoding];
if (!incomingServerUUID || [incomingServerUUID length] == 0) {
DLog(@"The TXT record UUID was zero length.");
[incomingServerUUID release], incomingServerUUID = nil;
return;
}
+ NSArray *deregisteredServers = [[NSUserDefaults standardUserDefaults] objectForKey:zsDeregisteredServersKey];
+ if (deregisteredServers && [deregisteredServers containsObject:incomingServerUUID]) {
+ [self setServerAction:ZSyncServerActionLatentDeregistration];
+ BLIPConnection *conn = [[BLIPConnection alloc] initToNetService:bonjourService];
+ [self setConnection:conn];
+ [conn setDelegate:self];
+ [conn open];
+ [conn release], conn = nil;
+ }
+
ZSyncService *zSyncService = [[ZSyncService alloc] init];
[zSyncService setService:bonjourService];
[zSyncService setName:incomingServerName];
@@ -797,6 +892,7 @@ - (void)netService:(NSNetService *)sender didNotResolve:(NSDictionary *)errorDic
{
[lock lock];
+ DLog(@"%s", __PRETTY_FUNCTION__);
[[self discoveredServers] removeObject:sender];
// Did not find our registered server. Fail
@@ -819,12 +915,15 @@ - (void)netService:(NSNetService *)sender didUpdateTXTRecordData:(NSData *)data
#pragma mark -
#pragma mark BLIPConnectionDelegate methods
-/* Two possible states at this point. If we have a server UUID
+/* Three possible states at this point. If we have a server UUID
* then we are ready to start a sync. If we do not have a server UUID
- * then we need to start a pairing.
+ * then we need to start a pairing. If we do not have a server UUID but
+ * we have a previously deregistered server UUID then we need to tell
+ * that server it's been deregistered.
*/
- (void)connectionDidOpen:(BLIPConnection *)connection
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
DLog(@"%s entered", __PRETTY_FUNCTION__);
// Start by confirming that the server still supports our schema and version
@@ -855,6 +954,7 @@ - (void)connectionDidOpen:(BLIPConnection *)connection
*/
- (void)connection:(TCPConnection *)connection failedToOpen:(NSError *)error
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
DLog(@"%s entered", __PRETTY_FUNCTION__);
[_connection close], [_connection release], _connection = nil;
[[self delegate] zSync:self errorOccurred:error];
@@ -870,6 +970,34 @@ - (void)connection:(BLIPConnection *)connection receivedResponse:(BLIPResponse *
DLog(@"%s entered\n%@", __PRETTY_FUNCTION__, [[response properties] allProperties]);
NSInteger action = [[[response properties] valueOfProperty:zsAction] integerValue];
switch (action) {
+ case zsActionLatentDeregisterClient:
+ DLog(@"%s zsActionLatentDeregisterClient", __PRETTY_FUNCTION__);
+
+ NSString *registeredServerUUID = [response valueOfProperty:zsServerUUID];
+ DLog(@"%s registeredServerUUID %@", __PRETTY_FUNCTION__, registeredServerUUID);
+ // TODO: Compare version numbers
+ ZAssert(registeredServerUUID != nil, @"Body string is nil in request\n%@", [[response properties] allProperties]);
+
+ NSMutableArray *deregisteredServers = [[NSMutableArray alloc] initWithArray:[[NSUserDefaults standardUserDefaults] arrayForKey:zsDeregisteredServersKey]];
+ if (!deregisteredServers) {
+ return; // Shouldn't really happen...
+ }
+
+ if (registeredServerUUID) {
+ [deregisteredServers removeObject:registeredServerUUID];
+ [[NSUserDefaults standardUserDefaults] setObject:deregisteredServers forKey:zsDeregisteredServersKey];
+ }
+
+ [[NSUserDefaults standardUserDefaults] synchronize];
+
+ [deregisteredServers release], deregisteredServers = nil;
+
+ [self setServerAction:ZSyncServerActionNoActivity];
+ [[self connection] close];
+ [self setConnection:nil];
+
+ return;
+
case zsActionDeregisterClient:
DLog(@"%s zsActionDeregisterClient", __PRETTY_FUNCTION__);
if ([[self delegate] respondsToSelector:@selector(zSyncDeregisterComplete:)]) {
@@ -997,6 +1125,7 @@ - (BOOL)connection:(BLIPConnection *)connection receivedRequest:(BLIPRequest *)r
- (void)connectionDidClose:(TCPConnection *)connection;
{
+ DLog(@"%s", __PRETTY_FUNCTION__);
if (![self connection]) {
return;
}
View
5 SharedCode/ZSyncShared.h
@@ -33,7 +33,7 @@
#define zsDeviceGUID @"zsDeviceGUID"
#define zsSchemaIdentifier @"ZSyncSchemaIdentifier"
-#define zsServerNameSeperator @"ZSyncServerNameSeparator"
+#define zsDeregisteredServersKey @"zsDeregisteredServersKey"
#define zsActID(__ENUM__) [NSString stringWithFormat:@"%i", __ENUM__]
@@ -51,7 +51,8 @@ enum {
zsActionSchemaUnsupported,
zsActionFileReceived,
zsActionTestFileTransfer,
- zsActionDeregisterClient
+ zsActionDeregisterClient,
+ zsActionLatentDeregisterClient
};
typedef enum {

0 comments on commit 280826d

Please sign in to comment.
Something went wrong with that request. Please try again.