We had some data races in the broker that occur when proxies and clients
modify the heap/snowflake map at the same time. This test has a client
and proxy access the broker simultaneously to check for data races.
There's a race condition in the broker where both the proxy and the
client processes try to pop/remove the same snowflake from the heap.
This patch adds synchronization to prevent simultaneous accesses to
snowflakes.
Proxies now include information about what type they are when they poll
for client offers. The broker saves this information along with
snowflake ids and outputs it on the /debug page.
Switch to containing all communication between the proxy and the broker
in the HTTP response body. This will make things easier if we ever use
something other than HTTP communicate between different actors in the
snowflake system.
Other changes to the protocol are as follows:
- requests are accompanied by a version number so the broker can be
backwards compatable if desired in the future
- all responses are 200 OK unless the request was badly formatted
The variable maxNumClients was unused, while connectionsPerClient was
used for spawning multiple proxyPairs. The former is a more appropriate
name for the multiplexing behaviour we use it for.
Multiplexing now just works thanks to implementing ticket #31310.
We don't need it, and already have a function webrtcIsReady that tells
us what we need to know (whether a datachannel was opened before the
timeout period).
The only place it was used was in window.onpageunload, and we have a
better way of determining if the proxy is active there (through the ui).
I also removed that code from the webextension since the proxy won't
stop running unless you close the browser and after testing it looks
like that code doesn't notify the user anyway.
Added a new script to package the webextension. This will automatically
build and zip the source code and the webextension for upload. It take a
version as an argument and then checks the version in the manifest, and
locally commits a version bump.
last was initialised twice (creating a shadow), the second time inside
a case statement. The second initialisation is removed, keeping the use
of last aligned to the isame style as its use other parts of the case
statement.
- Error strings are no longer capitalized nor end with punctuation
- Alias import
- Remove extraneous initilisation code (No need to provide zero value
for variables, because the compiler does that anyway)