Issue 128: Convert frame::Reason to struct (#142)
Alter frame::Reason to a struct with a single u32 member. Introduce Constants to the impl for existing Reasons. Change all usage in the library and its tests to adopt this change, using the new constants.
This commit is contained in:
committed by
Carl Lerche
parent
1c179f7bf2
commit
2aee78c7d7
@@ -1,7 +1,6 @@
|
||||
use codec::{RecvError, UserError};
|
||||
use codec::UserError::*;
|
||||
use frame::Reason;
|
||||
use frame::Reason::*;
|
||||
use proto;
|
||||
|
||||
use self::Inner::*;
|
||||
@@ -166,7 +165,7 @@ impl State {
|
||||
},
|
||||
_ => {
|
||||
// All other transitions result in a protocol error
|
||||
return Err(RecvError::Connection(ProtocolError));
|
||||
return Err(RecvError::Connection(Reason::PROTOCOL_ERROR));
|
||||
},
|
||||
};
|
||||
|
||||
@@ -180,7 +179,7 @@ impl State {
|
||||
self.inner = ReservedRemote;
|
||||
Ok(())
|
||||
},
|
||||
_ => Err(RecvError::Connection(ProtocolError)),
|
||||
_ => Err(RecvError::Connection(Reason::PROTOCOL_ERROR)),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +199,7 @@ impl State {
|
||||
self.inner = Closed(None);
|
||||
Ok(())
|
||||
},
|
||||
_ => Err(RecvError::Connection(ProtocolError)),
|
||||
_ => Err(RecvError::Connection(Reason::PROTOCOL_ERROR)),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user