11package server
22
33import (
4+ "crypto/tls"
45 "io"
56 "log"
67 "net"
@@ -21,6 +22,12 @@ import (
2122 "k8s.io/utils/keymutex"
2223)
2324
25+ var deviceConnectClient = & http.Client {
26+ Transport : & http.Transport {
27+ TLSNextProto : make (map [string ]func (authority string , c * tls.Conn ) http.RoundTripper ),
28+ },
29+ }
30+
2431type DeviceKeeper struct {
2532 adbClient * adb.Adb
2633 deviceWatcher * adb.DeviceWatcher
@@ -233,7 +240,7 @@ func connectAP(url, token, protocol, serial string) (*smux.Session, error) {
233240 req .Header .Set ("Upgrade" , protocol )
234241 req .Header .Set ("User-Agent" , "GBOX-cli" )
235242 req .Header .Set ("Authorization" , "Bearer " + token )
236- resp , err := http . DefaultClient .Do (req )
243+ resp , err := deviceConnectClient .Do (req )
237244 if err != nil {
238245 return nil , errors .Wrapf (err , "failed to connect to access point %s via %s protocol" , url , protocol )
239246 }
@@ -262,7 +269,7 @@ func connectAP(url, token, protocol, serial string) (*smux.Session, error) {
262269func (dm * DeviceKeeper ) processDeviceSession (session * DeviceSession , serial string ) {
263270 defer func () {
264271 if r := recover (); r != nil {
265- log .Printf ("recovered from device %s processDeviceSession goroutine: %v" , serial , r )
272+ log .Printf ("recovered from device %s processDeviceSession goroutine: %v: %s " , serial , r , string ( debug . Stack ()) )
266273 }
267274 }()
268275
0 commit comments