Fix session ID issue, we only need a new session when we really need a new session, i.e. give people a way to ask for it instead of trying to guess

This commit is contained in:
idk
2020-11-22 12:31:20 -05:00
parent 9baee36493
commit 3c5397e87f
6 changed files with 51 additions and 23 deletions

View File

@ -9,6 +9,8 @@ import (
// DialContext implements the net.DialContext function and can be used for http.Transport
func (c *Client) DialContext(ctx context.Context, network, addr string) (net.Conn, error) {
c.oml.Lock()
defer c.oml.Unlock()
errCh := make(chan error, 1)
connCh := make(chan net.Conn, 1)
go func() {
@ -42,7 +44,6 @@ func (c *Client) dialCheck(addr string) (int32, bool) {
return c.NewID(), true
} else if c.lastaddr != addr {
fmt.Println("Preparing to dial next new address.")
return c.NewID(), true
}
return c.id, false
}