Opened 10 years ago

Closed 10 years ago

#4388 closed Bug (fixed)

BonjourController service name fix

Reported by: wlisac Owned by: Will Lisac
Priority: Normal Milestone: 2.40
Component: Mac Client Version: 2.33
Severity: Normal Keywords: Bonjour
Cc:

Description

The current BonjourController?.m implementation creates a service "uniquely" identified by the computer's username, specifically NSUserName. This becomes a problem when multiple computers have the same username attempting to advertise a transmission web server because only one instance appears in the bonjour browser in Safari.

I would advise switching from using the Username as the unique identifier to the Computer name.

For example, the service would be called "Transmission Web Interface (Will's Mac Pro)" instead of "Transmission Web Interface (Will)".

I have attached to replacement code and it simply replaced:

NSString * serviceName = [NSString stringWithFormat: @"Transmission Web Interface (%@)", NSUserName()];

with:

NSString * serviceName = [NSString stringWithFormat: @"Transmission Web Interface (%@)", NSHost currentHost] localizedName?;

Thank you, Will

Attachments (1)

BonjourController.m (2.5 KB) - added by wlisac 10 years ago.
BonjourController?.m fixed

Download all attachments as: .zip

Change History (4)

Changed 10 years ago by wlisac

comment:1 Changed 10 years ago by livings124

What if two people have the same computer name?

comment:2 Changed 10 years ago by wlisac

I believe that OS X will automatically rename the computer by appending (1), (2), (3), etc to the computer name if it sees another computer with the same name on the local network. Either way, I believe it to be much less likely that someone would have two computers with the same name than two computers with the same username. Alternatively, you could always use a combination of the computer name and username for the service name.

comment:3 Changed 10 years ago by livings124

  • Milestone changed from None Set to 2.40
  • Resolution set to fixed
  • Status changed from new to closed

r12596

I've included the user name and the computer name. Thanks!

Note: See TracTickets for help on using tickets.