mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Redefine Close behavior:
- When Participant A was closed by remote side. Then a `disconnect` on `A` shall return Ok() (instead of ParticipantDisconected) IF: A was already flushed and no data needs to be sended any more. so a `disconnect` doesnt differ if the other side initiated the disconnect before or not. it tries to clean things up and returns Ok(()) if both sides agree
This commit is contained in:
parent
91d296cda1
commit
5fe7c05d9c
@ -667,7 +667,10 @@ impl BParticipant {
|
||||
sender
|
||||
.send(match lock.error.take() {
|
||||
None => Ok(()),
|
||||
Some(e) => Err(e),
|
||||
Some(ParticipantError::ProtocolFailedUnrecoverable) => {
|
||||
Err(ParticipantError::ProtocolFailedUnrecoverable)
|
||||
},
|
||||
Some(ParticipantError::ParticipantDisconnected) => Ok(()),
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
|
@ -42,11 +42,7 @@ fn close_participant() {
|
||||
let (_n_a, p1_a, mut s1_a, _n_b, p1_b, mut s1_b) = block_on(network_participant_stream(tcp()));
|
||||
|
||||
block_on(p1_a.disconnect()).unwrap();
|
||||
//As no more read/write is run disconnect is successful or already disconnected
|
||||
match block_on(p1_b.disconnect()) {
|
||||
Ok(_) | Err(ParticipantError::ParticipantDisconnected) => (),
|
||||
e => panic!("wrong disconnect type {:?}", e),
|
||||
};
|
||||
block_on(p1_b.disconnect()).unwrap();
|
||||
|
||||
assert_eq!(s1_a.send("Hello World"), Err(StreamError::StreamClosed));
|
||||
assert_eq!(
|
||||
|
Loading…
Reference in New Issue
Block a user