Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions controlfloor.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ type ControlFloor struct {
DevTracker *DeviceTracker
vidConns map[string] *ws.Conn
selfSigned bool
delayed bool
}

func NewControlFloor( config *Config ) (*ControlFloor, chan bool) {
Expand Down Expand Up @@ -67,6 +68,7 @@ func NewControlFloor( config *Config ) (*ControlFloor, chan bool) {
pass: pass,
lock: &sync.Mutex{},
vidConns: make( map[string] *ws.Conn ),
delayed: false
}
if config.https {
self.base = "https://" + config.cfHost
Expand All @@ -88,7 +90,6 @@ func NewControlFloor( config *Config ) (*ControlFloor, chan bool) {

go func() {
exit := false
delayed := false
for {
select {
case <- stopCf:
Expand All @@ -108,11 +109,11 @@ func NewControlFloor( config *Config ) (*ControlFloor, chan bool) {
fmt.Println("Waiting 10 seconds to retry...")
time.Sleep( time.Second * 10 )
fmt.Println("trying again\n")
delayed = true
self.delayed = true
continue
}

if delayed {
if self.delayed {
self.DevTracker.cfReady()
}

Expand Down
3 changes: 2 additions & 1 deletion device_tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func (self *DeviceTracker) onDeviceConnect1( bdev BridgeDev ) *Device {

if !self.cf.ready {
self.pendingDevs = append( self.pendingDevs, bdev )
self.cf.delayed = true
fmt.Printf("Device attached, but ControlFloor not ready.\n udid=%s\n", udid )
return nil
}
Expand Down Expand Up @@ -252,4 +253,4 @@ func (self *DeviceTracker) onDeviceConnect( uuid string, bdev BridgeDev ) (*Devi

func (self *DeviceTracker) onDeviceDisconnect( dev *Device ) {
dev.connected = false
}
}