Revision: 27862
          http://sourceforge.net/p/bibdesk/svn/27862
Author:   hofman
Date:     2022-09-06 23:59:00 +0000 (Tue, 06 Sep 2022)
Log Message:
-----------
only notified changed sharing clients when the number changes

Modified Paths:
--------------
    trunk/bibdesk/BDSKSharingServer.m

Modified: trunk/bibdesk/BDSKSharingServer.m
===================================================================
--- trunk/bibdesk/BDSKSharingServer.m   2022-09-06 23:24:18 UTC (rev 27861)
+++ trunk/bibdesk/BDSKSharingServer.m   2022-09-06 23:59:00 UTC (rev 27862)
@@ -615,12 +615,16 @@
 }
 
 - (void)setNumberOfConnections:(NSUInteger)count {
+    BOOL changed = NO;
     [rwLock lockForWriting];
+    changed = (numberOfConnections != count);
     numberOfConnections = count;
     [rwLock unlock];
-    dispatch_async(dispatch_get_main_queue(), ^{
-        [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKClientConnectionsChangedNotification object:nil];
-    });
+    if (changed) {
+        dispatch_async(dispatch_get_main_queue(), ^{
+            [[NSNotificationCenter defaultCenter] 
postNotificationName:BDSKClientConnectionsChangedNotification object:nil];
+        });
+    }
 }
 
 #pragma mark Main Thread
@@ -679,8 +683,7 @@
     [connectedClients makeObjectsPerformSelector:@selector(invalidate)];
     [connectedClients removeAllObjects];
     [registeredClients removeAllObjects];
-    if ([self numberOfConnections] > 0)
-        [self setNumberOfConnections:0];
+    [self setNumberOfConnections:0];
     
     NSPort *port = [[NSSocketPortNameServer sharedInstance] 
portForName:sharingName];
     [[NSSocketPortNameServer sharedInstance] removePortForName:sharingName];

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

Reply via email to