refactor: Improve handshake resiliency of peer (#95)

* fix: Synchronize peer logging with a channel

We were depending on the close mutex to properly
report connection state. This ensures the RTC
connection is properly closed before returning.

* Disable pion logging

* Remove buffer

* Try ICE servers

* Remove flushed

* Add diagram explaining handshake

* Fix candidate accept ordering

* Add debug logging to peerbroker

* Fix send ordering

* Lock adding ICE candidate

* Add test for negotiating out of order

* Reduce connection to a single negotiation channel

* Improve test times by pre-installing Terraform

* Lock remote session description being applied

* Organize conn

* Revert to multi-channel setup

* Properly close ICE gatherer

* Improve comments

* Try removing buffered candidates

* Buffer local and remote messages

* Log dTLS transport state

* Add pion logging
This commit is contained in:
Kyle Carberry
2022-01-30 20:11:18 -06:00
committed by GitHub
parent a7d6f4b673
commit 9db5fb0952
14 changed files with 330 additions and 271 deletions

View File

@ -9,27 +9,16 @@ import (
"path/filepath"
"testing"
"github.com/hashicorp/go-version"
"github.com/stretchr/testify/require"
"storj.io/drpc/drpcconn"
"github.com/coder/coder/provisionersdk"
"github.com/coder/coder/provisionersdk/proto"
"github.com/hashicorp/hc-install/product"
"github.com/hashicorp/hc-install/releases"
)
func TestProvision(t *testing.T) {
t.Parallel()
installer := &releases.ExactVersion{
Product: product.Terraform,
Version: version.Must(version.NewVersion("1.1.2")),
}
execPath, err := installer.Install(context.Background())
require.NoError(t, err)
client, server := provisionersdk.TransportPipe()
ctx, cancelFunc := context.WithCancel(context.Background())
t.Cleanup(func() {
@ -42,7 +31,6 @@ func TestProvision(t *testing.T) {
ServeOptions: &provisionersdk.ServeOptions{
Transport: server,
},
BinaryPath: execPath,
})
require.NoError(t, err)
}()