mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-04 20:17:09 +00:00
fix(ios): one address picker for every bring-up
bringUpRunner reads the picker from a field, and NewDevice only ever set the device one, so a device driver that reached bringUpRunner would call nil. The two fields held the same function; keeping one leaves no path that can be wired without it.
This commit is contained in:
1 parent
d124354379
commit
01f9ea942c
2 files changed
+8
-5
No files matched your search
@@ -103,9 +103,9 @@ func NewDevice(ctx context.Context, options DeviceOptions) (*Driver, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if options.pickAddress != nil {
|
if options.pickAddress != nil {
|
||||||
d.pickDeviceAddress = options.pickAddress
|
d.pickRunnerAddress = options.pickAddress
|
||||||
} else {
|
} else {
|
||||||
d.pickDeviceAddress = pickLoopbackAddress
|
d.pickRunnerAddress = pickLoopbackAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
// Device seams: clear-state reinstalls via devicectl; the container reset and
|
// Device seams: clear-state reinstalls via devicectl; the container reset and
|
||||||
@@ -159,7 +159,7 @@ func NewDevice(ctx context.Context, options DeviceOptions) (*Driver, error) {
|
|||||||
// health. The build runs inside spawnRunner under the process context, so the
|
// health. The build runs inside spawnRunner under the process context, so the
|
||||||
// startup timeout only bounds the post-spawn wait, not the build.
|
// startup timeout only bounds the post-spawn wait, not the build.
|
||||||
func (d *Driver) bringUpDevice(ctx context.Context) error {
|
func (d *Driver) bringUpDevice(ctx context.Context) error {
|
||||||
address, err := d.pickDeviceAddress()
|
address, err := d.pickRunnerAddress()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,9 +162,13 @@ type Driver struct {
|
|||||||
runnerAddress string
|
runnerAddress string
|
||||||
spawnRunner func(ctx context.Context, address string) (*exec.Cmd, error)
|
spawnRunner func(ctx context.Context, address string) (*exec.Cmd, error)
|
||||||
dialRunner func(address string) (transport.Companion, error)
|
dialRunner func(address string) (transport.Companion, error)
|
||||||
pickRunnerAddress func() (string, error)
|
|
||||||
hybrid bool
|
hybrid bool
|
||||||
|
|
||||||
|
// pickRunnerAddress hands every bring-up a free loopback port, on the
|
||||||
|
// simulator and the device alike. One field, so no path can be wired
|
||||||
|
// without it.
|
||||||
|
pickRunnerAddress func() (string, error)
|
||||||
|
|
||||||
// Device-mode fields. On the physical-device path d.companion is the runner
|
// Device-mode fields. On the physical-device path d.companion is the runner
|
||||||
// dialed over a usbmux tunnel, hybrid is false, and runnerClient is nil.
|
// dialed over a usbmux tunnel, hybrid is false, and runnerClient is nil.
|
||||||
// coreDeviceID feeds devicectl; tunnel is the in-process usbmux forwarder
|
// coreDeviceID feeds devicectl; tunnel is the in-process usbmux forwarder
|
||||||
@@ -173,7 +177,6 @@ type Driver struct {
|
|||||||
coreDeviceID string
|
coreDeviceID string
|
||||||
tunnel io.Closer
|
tunnel io.Closer
|
||||||
startTunnel func(ctx context.Context, hardwareUDID, localAddress, devicePort string) (io.Closer, error)
|
startTunnel func(ctx context.Context, hardwareUDID, localAddress, devicePort string) (io.Closer, error)
|
||||||
pickDeviceAddress func() (string, error)
|
|
||||||
|
|
||||||
// processContext owns the companion child's lifetime: it is derived from
|
// processContext owns the companion child's lifetime: it is derived from
|
||||||
// New's context (so a canceled run still reaps the child) and canceled by
|
// New's context (so a canceled run still reaps the child) and canceled by
|
||||||
|
|||||||
Reference in new issue
Block a user