Opened 5 years ago

Closed 5 years ago

#8171 closed enhancement (fixed)

Facilitator tells proxies how often to poll

Reported by: dcf Owned by: aallai
Priority: Medium Milestone:
Component: Archived/Flashproxy Version:
Severity: Keywords:
Cc: Actual Points:
Parent ID: #8172 Points:
Reviewer: Sponsor:

Description

Flash proxies have a built-in hard-coded polling interval (currently 10 minutes). When we needed to change the polling interval, I pushed a new version of flashproxy.js (commits 49de7bf6 and 69d429db). They should rather get their polling interval from the facilitator. That is, in response to a polling request, the facilitator sends back

client=&check-back-in=600

meaning, no client now, try again in 10 minutes. Send check-back-in even if the response contains a client.

The benefits of the facilitator controlling the polling interval are:

  • facilitator can dynamically change the interval to maintain a desired polling level
  • different intervals can be given to IPv4 and IPv6 proxies (we want IPv6 to poll faster because there are fewer of them)
  • we want to rate-limit polling (#7823) and it means changing policy in just one place (the facilitator) and not having to change proxy code at the same time to match.

The logic behind this needs to be in facilitator, not facilitator.cgi. In other words, facilitator.cgi sends to facilitator

GET FROM=1.2.3.4:10000

and facilitator sends back

NONE CHECK-BACK-IN="600"

or

OK CLIENT="9.9.9.9:9999" RELAY="123.123.123.123:9901" CHECK-BACK-IN="600"

Dynamic changing of the polling interval is not part of this ticket. This ticket is only to hardcode 10 minutes in the facilitator and to make proxies obey it.

Child Tickets

Change History (6)

comment:1 Changed 5 years ago by dcf

Keywords: #8172 added

#8172 is about a dynamic polling interval, after this ticket is done.

comment:2 Changed 5 years ago by dcf

Keywords: #8172 removed
Parent ID: #8172

comment:3 Changed 5 years ago by aallai

Status: newneeds_review

Implemented at https://github.com/aallai/flashproxy.git branch poll_interval.

The implementation makes the facilitator_poll_interval option obsolete, since it's ignored in favour of what the facilitator sends. I haven't removed the code or documentation for it though. Do we want to let people hosting the badge override what the facilitator says, using that option? 

comment:4 Changed 5 years ago by dcf

Status: needs_reviewneeds_revision

Good work on this. It's almost ready.

Don't make it an error in get_reg if the facilitator doesn't send CHECK-BACK-IN. It shouldn't be required. facilitator.cgi should cope with this situation by not sending back a check-back-in value.

Process the value in flashproxy.js with get_param_integer, not get_param_timespec.

Declare the local var poll_interval.

I want facilitator_poll_interval to override what the facilitator says in all cases. The global facilitator_poll_interval should not change once initialized.

if facilitator_poll_interval, use that
elseif check-back-in, use that
else use DEFAULT_FACILITATOR_POLL_INTERVAL

In all the above cases, take the max of what you decide and MIN_FACILITATOR_POLL_INTERVAL.

Bump DEFAULT_FACILITATOR_POLL_INTERVAL up to 1 hour--that case shouldn't happen unless there's a problem somewhere. Increase MIN_FACILITATOR_POLL_INTERVAL to 10 seconds.

If the proxy gets a nonsense check-back-in (get_param_integer returns null), log the error and fall back to DEFAULT_FACILITATOR_POLL_INTERVAL.

comment:5 Changed 5 years ago by aallai

Status: needs_revisionneeds_review

Javascript is a madman that will globalize anything that moves.

I've fixed up the poll_interval branch.

comment:6 Changed 5 years ago by dcf

Resolution: fixed
Status: needs_reviewclosed

Thanks, now committed.

Note: See TracTickets for help on using tickets.