Revision: 29700
          http://sourceforge.net/p/bibdesk/svn/29700
Author:   hofman
Date:     2025-10-10 18:02:42 +0000 (Fri, 10 Oct 2025)
Log Message:
-----------
seet actual sharingName only when netservice is created

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

Modified: trunk/bibdesk/BDSKSharingServer.m
===================================================================
--- trunk/bibdesk/BDSKSharingServer.m   2025-10-10 17:39:00 UTC (rev 29699)
+++ trunk/bibdesk/BDSKSharingServer.m   2025-10-10 18:02:42 UTC (rev 29700)
@@ -140,7 +140,6 @@
 - (instancetype)init NS_UNAVAILABLE;
 
 @property NSUInteger numberOfConnections;
-@property (nonatomic, readonly) NSString *sharingName;
 
 - (void)notifyClientsOfChange;
 
@@ -410,20 +409,20 @@
     }
 }
 
-- (void)server:(BDSKAsyncSharingServer *)aServer didSetupWithPort:(int)port {
+- (void)asyncServer:(BDSKAsyncSharingServer *)aServer 
didSetupWithSharingName:(NSString *)aSharingName port:(int)port {
     BDSKASSERT(aServer == asyncServer || asyncServer == nil);
     // the service was able to register the port
     
     BDSKPRECONDITION(netService == nil);
     
-    [self setSharingName:[aServer sharingName]];
-    
     // lazily instantiate the NSNetService object that will advertise on our 
behalf
-    netService = [self newNetServiceWithSharingName:[self sharingName] 
port:port];
+    netService = [self newNetServiceWithSharingName:aSharingName port:port];
     
     BDSKPOSTCONDITION(netService != nil);
     
     if (netService) {
+        [self setSharingName:aSharingName];
+        
         // our DO server will also use Bonjour, but this gives us a browseable 
name
         [netService publishWithOptions:NSNetServiceNoAutoRename];
         
@@ -497,6 +496,16 @@
     }
 }
 
+- (void)netServiceWillPublish:(NSNetService *)sender
+{
+    [self setStatus:BDSKSharingStatusPublishing];
+}
+
+- (void)netServiceDidPublish:(NSNetService *)sender
+{
+    [self setStatus:BDSKSharingStatusSharing];
+}
+
 - (void)netService:(NSNetService *)sender didNotPublish:(NSDictionary 
*)errorDict
 {
     NSInteger err = [[errorDict objectForKey:NSNetServicesErrorCode] 
integerValue];
@@ -582,7 +591,6 @@
 
 @implementation BDSKAsyncSharingServer
 
-@synthesize sharingName;
 @dynamic numberOfConnections;
 
 // This is the minimal version for the client that we require
@@ -589,7 +597,7 @@
 // If we introduce incompatible changes in future, bump this to avoid sharing 
breakage
 + (NSString *)requiredClientProtocolVersion { return @"0"; }
 
-- (instancetype)initWithSharingName:(NSString *)aSharingName 
forSharingServer:(BDSKSharingServer *)aSharingServer 
+- (instancetype)initWithSharingName:(NSString *)aSharingName 
forSharingServer:(BDSKSharingServer *)aSharingServer
 {
     self = [super init];
     if (self) {
@@ -665,7 +673,7 @@
         [connection setDelegate:self];
 #pragma clang diagnostic pop
         dispatch_async(dispatch_get_main_queue(), ^{
-            [sharingServer server:self didSetupWithPort:port];
+            [sharingServer asyncServer:self 
didSetupWithSharingName:sharingName port:port];
             // this is no longer needed
             sharingServer = nil;
         });

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