Skip to content

Commit

Permalink
Fixed unreliable browse resolve, per PR: mono/Mono.Zeroconf#11
Browse files Browse the repository at this point in the history
  • Loading branch information
cerebrate committed Apr 30, 2017
1 parent 46204e9 commit a3e5283
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Arkane.Zeroconf/Providers/Bonjour/BrowseService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,22 @@ public BrowseService (string name, string replyDomain, string regtype) : base (n

public event ServiceResolvedEventHandler Resolved ;

public void Resolve () { this.Resolve (false) ; }
public void Resolve ()
{
// If people call this in a ServiceAdded event handler (which they generally do), we need to
// invoke onto another thread, otherwise we block processing any more results.
this.resolveAction.BeginInvoke (false, null, null) ;
}

private void SetupCallbacks ()
{
this.resolve_reply_handler = this.OnResolveReply ;
this.query_record_reply_handler = this.OnQueryRecordReply ;
this.resolveAction = this.Resolve;
}

private Action <bool> resolveAction ;

public void Resolve (bool requery)
{
if (this.resolve_pending)
Expand Down

0 comments on commit a3e5283

Please sign in to comment.