Skip to content

Commit

Permalink
fmt: format
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuka007 committed Jan 22, 2025
1 parent 25c1a82 commit fd4eeed
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
12 changes: 7 additions & 5 deletions kernel/src/net/net_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ use crate::{
driver::net::{Iface, Operstate},
libs::rwlock::RwLockReadGuard,
net::NET_DEVICES,
time::{
sleep::nanosleep,
PosixTimeSpec,
},
time::{sleep::nanosleep, PosixTimeSpec},
};

pub fn net_init() -> Result<(), SystemError> {
Expand All @@ -21,7 +18,12 @@ fn dhcp_query() -> Result<(), SystemError> {
let binding = NET_DEVICES.write_irqsave();

// Default iface, misspelled to net_face
let net_face = binding.iter().find(|(_, iface)| iface.common().is_default_iface()).unwrap().1.clone();
let net_face = binding
.iter()
.find(|(_, iface)| iface.common().is_default_iface())
.unwrap()
.1
.clone();

drop(binding);

Expand Down
5 changes: 3 additions & 2 deletions kernel/src/net/socket/inet/datagram/inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,14 @@ impl UnboundUdp {
}

pub fn bind(self, local_endpoint: smoltcp::wire::IpEndpoint) -> Result<BoundUdp, SystemError> {

let inner = BoundInner::bind(self.socket, &local_endpoint.addr)?;
let bind_addr = local_endpoint.addr;
let bind_port = if local_endpoint.port == 0 {
inner.port_manager().bind_ephemeral_port(InetTypes::Udp)?
} else {
inner.port_manager().bind_port(InetTypes::Udp, local_endpoint.port)?;
inner
.port_manager()
.bind_port(InetTypes::Udp, local_endpoint.port)?;
local_endpoint.port
};

Expand Down
5 changes: 3 additions & 2 deletions kernel/src/net/socket/inet/datagram/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ impl UdpSocket {
let ret = bound.try_recv(buf);
poll_ifaces();
ret
},
}
_ => Err(ENOTCONN),
}
}
Expand Down Expand Up @@ -199,7 +199,8 @@ impl Socket for UdpSocket {
if !self.is_bound() {
self.bind_emphemeral(remote.addr)?;
}
if let UdpInner::Bound(inner) = self.inner.read().as_ref().expect("UDP Inner disappear") {
if let UdpInner::Bound(inner) = self.inner.read().as_ref().expect("UDP Inner disappear")
{
inner.connect(remote);
return Ok(());
} else {
Expand Down

0 comments on commit fd4eeed

Please sign in to comment.