Connected Devices: fix stream finish
This commit is contained in:
@@ -406,6 +406,7 @@ impl DeviceSync {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
finish_send(&mut stream).await?;
|
||||||
let response = read_msg(&mut stream).await?;
|
let response = read_msg(&mut stream).await?;
|
||||||
match response {
|
match response {
|
||||||
WireMessage::PairResponse {
|
WireMessage::PairResponse {
|
||||||
@@ -599,6 +600,7 @@ impl DeviceSync {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
finish_send(&mut stream).await?;
|
||||||
match read_msg(&mut stream).await? {
|
match read_msg(&mut stream).await? {
|
||||||
WireMessage::SyncResponse {
|
WireMessage::SyncResponse {
|
||||||
accepted: true,
|
accepted: true,
|
||||||
@@ -1608,6 +1610,7 @@ async fn handle_pair_request(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
finish_send(&mut stream).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
profile.endpoint_id = stream.peer_id.to_string();
|
profile.endpoint_id = stream.peer_id.to_string();
|
||||||
@@ -1655,6 +1658,7 @@ async fn handle_pair_request(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
finish_send(&mut stream).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1691,6 +1695,7 @@ async fn handle_pair_request(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
finish_send(&mut stream).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1720,6 +1725,7 @@ async fn handle_hello(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
finish_send(&mut stream).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
if !is_active_trusted(&sync, &profile.device_id)? {
|
if !is_active_trusted(&sync, &profile.device_id)? {
|
||||||
@@ -1735,6 +1741,7 @@ async fn handle_hello(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
finish_send(&mut stream).await?;
|
||||||
return Ok(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
profile.endpoint_id = stream.peer_id.to_string();
|
profile.endpoint_id = stream.peer_id.to_string();
|
||||||
@@ -1768,6 +1775,7 @@ async fn handle_hello(
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
finish_send(&mut stream).await?;
|
||||||
sync.gc_tombstones()?;
|
sync.gc_tombstones()?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
@@ -2048,6 +2056,11 @@ async fn write_msg(stream: &mut ByteStream, message: &WireMessage) -> Result<()>
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async fn finish_send(stream: &mut ByteStream) -> Result<()> {
|
||||||
|
stream.send.finish()?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
async fn read_msg(stream: &mut ByteStream) -> Result<WireMessage> {
|
async fn read_msg(stream: &mut ByteStream) -> Result<WireMessage> {
|
||||||
let line = read_line(&mut stream.recv).await?;
|
let line = read_line(&mut stream.recv).await?;
|
||||||
Ok(serde_json::from_slice(&line)?)
|
Ok(serde_json::from_slice(&line)?)
|
||||||
|
|||||||
Reference in New Issue
Block a user