Websocket reconnection fix (#541)

* Adds potential fix for websocket reconnection failure

* Addr tests, we now don't return an error, this allows us to reuse existing if still in operation.

* update depends && go mod tidy

* adds in channel direction for parameter

* Add full subscriber function, increased test coverage, initiate go routine after calling routine instance check in connection monitor

* fix linter issue

* use protected methods for setting field variables

* removed function, added tests

* lock sub manipulation

* fix linter issue

* Added in transport idleconnection timeout to fix MACOS reconnection issue when all idle connections are consuming resources

* used protected methods to set underlying fields

* set variable via time.Duration param

* Added in lock around field variable in test

* Addr thrasher nits and expanded exchange tests

* Fix test

* Addr glorious nits

* go mod tidy

* Add a larger timeout for traffic monitor if the test runs slow
This commit is contained in:
Ryan O'Hara-Reid
2020-08-26 15:34:05 +10:00
committed by GitHub
parent 77df837b70
commit 870c8cb90e
9 changed files with 840 additions and 214 deletions

View File

@@ -283,10 +283,12 @@ func (r *Requester) SetProxy(p *url.URL) error {
return errors.New("no proxy URL supplied")
}
r.HTTPClient.Transport = &http.Transport{
Proxy: http.ProxyURL(p),
TLSHandshakeTimeout: proxyTLSTimeout,
t, ok := r.HTTPClient.Transport.(*http.Transport)
if !ok {
return errors.New("transport not set, cannot set proxy")
}
t.Proxy = http.ProxyURL(p)
t.TLSHandshakeTimeout = proxyTLSTimeout
return nil
}

View File

@@ -474,7 +474,7 @@ func TestGetNonceMillis(t *testing.T) {
func TestSetProxy(t *testing.T) {
t.Parallel()
r := New("test",
new(http.Client),
&http.Client{Transport: new(http.Transport)},
WithLimiter(&globalshell))
u, err := url.Parse("http://www.google.com")
if err != nil {