Add separate client for dynamic relays (fixes #2368)

Did some manual tests in the playground, such as kicking off two clients in parallel, first connecting,
second one getting a message about already being connected, falling back to the second address.
This commit is contained in:
Audrius Butkevicius
2015-10-16 23:59:24 +01:00
parent 8c26fe44c3
commit 4f0680c3c8
5 changed files with 551 additions and 375 deletions

View File

@@ -102,7 +102,11 @@ func JoinSession(invitation protocol.SessionInvitation) (net.Conn, error) {
func TestRelay(uri *url.URL, certs []tls.Certificate, sleep time.Duration, times int) bool {
id := syncthingprotocol.NewDeviceID(certs[0].Certificate[0])
invs := make(chan protocol.SessionInvitation, 1)
c := NewProtocolClient(uri, certs, invs)
c, err := NewClient(uri, certs, invs)
if err != nil {
close(invs)
return false
}
go c.Serve()
defer func() {
close(invs)