mirror of
https://github.com/cubixle/radius-rs.git
synced 2026-04-30 14:58:42 +01:00
Refactor
This commit is contained in:
+1
-1
@@ -62,7 +62,7 @@ impl RequestHandler<(), io::Error> for MyRequestHandler {
|
|||||||
info!("response => {:?} to {}", code, req.get_remote_addr());
|
info!("response => {:?} to {}", code, req.get_remote_addr());
|
||||||
|
|
||||||
conn.send_to(
|
conn.send_to(
|
||||||
&req_packet.response(code).encode().unwrap(),
|
&req_packet.make_response_packet(code).encode().unwrap(),
|
||||||
req.get_remote_addr(),
|
req.get_remote_addr(),
|
||||||
)
|
)
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
+2
-2
@@ -70,7 +70,7 @@ impl Packet {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn response(&self, code: Code) -> Self {
|
pub fn make_response_packet(&self, code: Code) -> Self {
|
||||||
Packet {
|
Packet {
|
||||||
code,
|
code,
|
||||||
identifier: self.identifier,
|
identifier: self.identifier,
|
||||||
@@ -136,7 +136,7 @@ impl Packet {
|
|||||||
* | Attributes ...
|
* | Attributes ...
|
||||||
* +-+-+-+-+-+-+-+-+-+-+-+-+-
|
* +-+-+-+-+-+-+-+-+-+-+-+-+-
|
||||||
*/
|
*/
|
||||||
pub fn marshal_binary(&self) -> Result<Vec<u8>, String> {
|
fn marshal_binary(&self) -> Result<Vec<u8>, String> {
|
||||||
let encoded_avp = match self.attributes.encode() {
|
let encoded_avp = match self.attributes.encode() {
|
||||||
Ok(encoded) => encoded,
|
Ok(encoded) => encoded,
|
||||||
Err(e) => return Err(e),
|
Err(e) => return Err(e),
|
||||||
|
|||||||
Reference in New Issue
Block a user