[lowpan][lowpan-spinel-driver] Reset the send window before calling open.

This change fixes a race condition in `SpinelDeviceSink::open` that
could cause the send window to be reset after the Spinel device had
already (re)opened and sent us a `OnReadyForSendFrames`. This would
cause the send window to remain at zero, resulting in no frames being
able to be sent to the device.

Aside from correcting what is a clear logic error, writing a unit test
for this change that would have failed previously but will now succeed
is tricky. The issue was discovered when testing on real hardware, and
manual verification indicates that this change does address the
problem. Existing tests continue to pass.

Test: fx test lowpan-tests
Change-Id: I933c7ba50f29357ac7b83a155e941ab8ff246a4b
Reviewed-on: https://fuchsia-review.googlesource.com/c/fuchsia/+/401679
Commit-Queue: Robert Quattlebaum <rquattle@google.com>
Testability-Review: Jiaming (Charlie) Wang <jiamingw@google.com>
Reviewed-by: Jiaming (Charlie) Wang <jiamingw@google.com>
diff --git a/src/connectivity/lowpan/drivers/lowpan-spinel-driver/src/spinel/device_client.rs b/src/connectivity/lowpan/drivers/lowpan-spinel-driver/src/spinel/device_client.rs
index bdf7b59..5099ece 100644
--- a/src/connectivity/lowpan/drivers/lowpan-spinel-driver/src/spinel/device_client.rs
+++ b/src/connectivity/lowpan/drivers/lowpan-spinel-driver/src/spinel/device_client.rs
@@ -75,13 +75,13 @@
     DP: fidl_fuchsia_lowpan_spinel::DeviceProxyInterface + Unpin + Clone,
 {
     async fn open(&self) -> Result<(), Error> {
+        self.send_window.reset();
         self.device_proxy
             .open()
             .await
             .context("device_proxy.open(): FIDL Error")?
             .map_err(SpinelError)
             .context("device_proxy.open(): Spinel Error")?;
-        self.send_window.reset();
         self.device_proxy
             .ready_to_receive_frames(INBOUND_FRAME_WINDOW_SIZE.try_into().unwrap())
             .context("device_proxy.ready_to_receive_frames(): FIDL Error")?;