Revision: 27883
http://sourceforge.net/p/bibdesk/svn/27883
Author: hofman
Date: 2022-09-10 21:17:17 +0000 (Sat, 10 Sep 2022)
Log Message:
-----------
remove client and invalidate its connection if it was not registered within 5
minutes
Modified Paths:
--------------
trunk/bibdesk/BDSKSharingServer.m
Modified: trunk/bibdesk/BDSKSharingServer.m
===================================================================
--- trunk/bibdesk/BDSKSharingServer.m 2022-09-10 21:08:31 UTC (rev 27882)
+++ trunk/bibdesk/BDSKSharingServer.m 2022-09-10 21:17:17 UTC (rev 27883)
@@ -687,6 +687,8 @@
if (connection == nil)
return;
+ [[self class] cancelPreviousPerformRequestsWithTarget:self];
+
[connectedClients makeObjectsPerformSelector:@selector(invalidate)];
[connectedClients removeAllObjects];
[registeredClients removeAllObjects];
@@ -700,6 +702,13 @@
BDSKDESTROY(connection);
}
+- (void)removeUnregisteredClient:(BDSKConnectedClient *)client {
+ if ([connectedClients containsObject:client] && [client proxy] == nil) {
+ [client invalidate];
+ [connectedClients removeObject:client];
+ }
+}
+
#pragma mark | NSConnection delegate
- (BOOL)connection:(NSConnection *)parentConnection
shouldMakeNewConnection:(NSConnection *)newConnection
@@ -718,6 +727,7 @@
else
[newConnection setDelegate:self];
[connectedClients addObject:client];
+ [self performSelector:@selector(removeUnregisteredClient:)
withObject:client afterDelay:300.0];
[client release];
} else {
NSLog(@"*** WARNING *** Maximum number of sharing clients (%ld)
exceeded.", (long)maxConnections);
@@ -752,9 +762,11 @@
[client invalidate];
[client release];
}else if([version numericCompare:[BDSKAsyncSharingServer
requiredProtocolVersion]] == NSOrderedAscending){
+ [[self class] cancelPreviousPerformRequestsWithTarget:self
selector:@selector(removeUnregisteredClient:) object:client];
[client invalidate];
[connectedClients removeObject:client];
}else{
+ [[self class] cancelPreviousPerformRequestsWithTarget:self
selector:@selector(removeUnregisteredClient:) object:client];
[clientObject setProtocolForProxy:@protocol(BDSKSharingClient)];
[client setProxy:clientObject];
[registeredClients setObject:client forKey:identifier];
@@ -778,6 +790,7 @@
NSParameterAssert(identifier != nil);
BDSKConnectedClient *client = [[registeredClients objectForKey:identifier]
retain];
if (client) {
+ [[self class] cancelPreviousPerformRequestsWithTarget:self
selector:@selector(removeUnregisteredClient:) object:client];
[registeredClients removeObjectForKey:identifier];
[connectedClients removeObject:client];
[[client connection] invalidate];
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
Bibdesk-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/bibdesk-commit