Commit dca4ea50 authored by Jeremy Soller's avatar Jeremy Soller

Post read fevent at EOF

parent 19aabd5e
......@@ -41,6 +41,10 @@ impl<'a, 'b> SchemeSocket for IcmpSocket<'a, 'b> {
self.can_recv()
}
fn may_recv(&self) -> bool {
true
}
fn get_setting(
_file: &SocketFile<Self::DataT>,
_setting: Self::SettingT,
......
......@@ -27,6 +27,10 @@ impl<'a, 'b> SchemeSocket for RawSocket<'a, 'b> {
self.can_recv()
}
fn may_recv(&self) -> bool {
true
}
fn get_setting(
_file: &SocketFile<Self::DataT>,
_setting: Self::SettingT,
......
......@@ -123,6 +123,7 @@ where
fn can_send(&self) -> bool;
fn can_recv(&self) -> bool;
fn may_recv(&self) -> bool;
fn hop_limit(&self) -> u8;
fn set_hop_limit(&mut self, u8);
......@@ -214,7 +215,7 @@ where
let mut socket_set = self.socket_set.borrow_mut();
let socket = socket_set.get::<SocketT>(socket_handle);
if events & syscall::EVENT_READ == syscall::EVENT_READ && socket.can_recv() {
if events & syscall::EVENT_READ == syscall::EVENT_READ && (socket.can_recv() || !socket.may_recv()) {
if !*read_notified {
post_fevent(&mut self.scheme_file, fd, syscall::EVENT_READ, 1)?;
*read_notified = true;
......
......@@ -26,6 +26,10 @@ impl<'a> SchemeSocket for TcpSocket<'a> {
self.can_recv()
}
fn may_recv(&self) -> bool {
self.may_recv()
}
fn hop_limit(&self) -> u8 {
self.hop_limit().unwrap_or(64)
}
......
......@@ -28,6 +28,10 @@ impl<'a, 'b> SchemeSocket for UdpSocket<'a, 'b> {
self.can_recv()
}
fn may_recv(&self) -> bool {
true
}
fn hop_limit(&self) -> u8 {
self.hop_limit().unwrap_or(64)
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment