YAACC - UPNP Client and Server
Loading...
Searching...
No Matches
de.yaacc.multiroom.discovery.ResolveRetry Class Reference

Which failed resolutions are tried again (task 11.6). More...

Collaboration diagram for de.yaacc.multiroom.discovery.ResolveRetry:
Collaboration graph

Public Member Functions

synchronized boolean shouldRetry (String serviceId, int errorCode)
 
synchronized boolean takePending (String serviceId)
 The wait of a retry is over:
 
synchronized void lost (String serviceId)
 The service is gone: a retry that waits for it is dropped and its count starts over.
 
synchronized void succeeded (String serviceId)
 The service was resolved: its next failure starts the count again.
 
synchronized void clear ()
 Forgets everything (the discovery stopped).
 

Static Public Attributes

static final int MAX_RETRIES = 2
 The most retries of one service.
 
static final long DELAY_MILLIS = 2_000L
 The wait before a retry.
 
static final int MAX_TRACKED = 64
 The most services counted at once.
 

Detailed Description

Which failed resolutions are tried again (task 11.6).

NsdManager answers a resolution with FAILURE_ALREADY_ACTIVE when the platform is busy with another one and, on many phones, with FAILURE_INTERNAL_ERROR for a service that resolves a moment later; both are retried, {@value MAX_RETRIES} times at most for one service and after {@value DELAY_MILLIS} ms, so a hostile network that makes every resolution fail causes a bounded number of calls. Every other code is final. The table is bounded: a flood of service names evicts the oldest. Pure and thread safe.

Member Function Documentation

◆ shouldRetry()

synchronized boolean de.yaacc.multiroom.discovery.ResolveRetry.shouldRetry ( String serviceId,
int errorCode )
Returns
true if the service should be resolved again (and counts this failure)

◆ takePending()

synchronized boolean de.yaacc.multiroom.discovery.ResolveRetry.takePending ( String serviceId)

The wait of a retry is over:

Returns
true if the service is still wanted (it was not lost meanwhile) and is to be resolved again. Once per retry.

The documentation for this class was generated from the following file: