Rename proto-* features back to socket-*.
A proto-* feature does not make sense for ICMP, where the protocol is always enabled, but sockets, not.
This commit is contained in:
parent
c2994b9757
commit
d9fa7f6bc6
16
.travis.yml
16
.travis.yml
|
@ -10,21 +10,21 @@ matrix:
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='default' MODE='test'
|
env: FEATURES='default' MODE='test'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='phy-raw_socket proto-udp' MODE='build'
|
env: FEATURES='phy-raw_socket socket-udp' MODE='build'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='phy-tap_interface proto-udp' MODE='build'
|
env: FEATURES='phy-tap_interface socket-udp' MODE='build'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='proto-raw' MODE='build'
|
env: FEATURES='socket-raw' MODE='build'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='proto-udp' MODE='build'
|
env: FEATURES='socket-udp' MODE='build'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='proto-tcp' MODE='build'
|
env: FEATURES='socket-tcp' MODE='build'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='proto-raw proto-udp proto-tcp' MODE='build'
|
env: FEATURES='socket-raw socket-udp socket-tcp' MODE='build'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='proto-raw proto-udp proto-tcp std' MODE='build'
|
env: FEATURES='socket-raw socket-udp socket-tcp std' MODE='build'
|
||||||
- rust: nightly
|
- rust: nightly
|
||||||
env: FEATURES='proto-raw proto-udp proto-tcp alloc' MODE='build'
|
env: FEATURES='socket-raw socket-udp socket-tcp alloc' MODE='build'
|
||||||
script:
|
script:
|
||||||
- cargo "$MODE" --no-default-features --features "$FEATURES"
|
- cargo "$MODE" --no-default-features --features "$FEATURES"
|
||||||
notifications:
|
notifications:
|
||||||
|
|
|
@ -28,12 +28,12 @@ alloc = ["managed/alloc"]
|
||||||
verbose = []
|
verbose = []
|
||||||
"phy-raw_socket" = ["std", "libc"]
|
"phy-raw_socket" = ["std", "libc"]
|
||||||
"phy-tap_interface" = ["std", "libc"]
|
"phy-tap_interface" = ["std", "libc"]
|
||||||
"proto-raw" = []
|
"socket-raw" = []
|
||||||
"proto-udp" = []
|
"socket-udp" = []
|
||||||
"proto-tcp" = []
|
"socket-tcp" = []
|
||||||
default = ["std", "log",
|
default = ["std", "log",
|
||||||
"phy-raw_socket", "phy-tap_interface",
|
"phy-raw_socket", "phy-tap_interface",
|
||||||
"proto-raw", "proto-udp", "proto-tcp"]
|
"socket-raw", "socket-udp", "socket-tcp"]
|
||||||
|
|
||||||
[[example]]
|
[[example]]
|
||||||
name = "tcpdump"
|
name = "tcpdump"
|
||||||
|
|
|
@ -12,12 +12,18 @@ use wire::{IpAddress, IpProtocol, IpRepr, IpCidr};
|
||||||
use wire::{ArpPacket, ArpRepr, ArpOperation};
|
use wire::{ArpPacket, ArpRepr, ArpOperation};
|
||||||
use wire::{Ipv4Packet, Ipv4Repr};
|
use wire::{Ipv4Packet, Ipv4Repr};
|
||||||
use wire::{Icmpv4Packet, Icmpv4Repr, Icmpv4DstUnreachable};
|
use wire::{Icmpv4Packet, Icmpv4Repr, Icmpv4DstUnreachable};
|
||||||
#[cfg(feature = "proto-udp")] use wire::{UdpPacket, UdpRepr};
|
#[cfg(feature = "socket-udp")]
|
||||||
#[cfg(feature = "proto-tcp")] use wire::{TcpPacket, TcpRepr, TcpControl};
|
use wire::{UdpPacket, UdpRepr};
|
||||||
|
#[cfg(feature = "socket-tcp")]
|
||||||
|
use wire::{TcpPacket, TcpRepr, TcpControl};
|
||||||
|
|
||||||
use socket::{Socket, SocketSet, AnySocket};
|
use socket::{Socket, SocketSet, AnySocket};
|
||||||
#[cfg(feature = "proto-raw")] use socket::RawSocket;
|
#[cfg(feature = "socket-raw")]
|
||||||
#[cfg(feature = "proto-udp")] use socket::UdpSocket;
|
use socket::RawSocket;
|
||||||
#[cfg(feature = "proto-tcp")] use socket::TcpSocket;
|
#[cfg(feature = "socket-udp")]
|
||||||
|
use socket::UdpSocket;
|
||||||
|
#[cfg(feature = "socket-tcp")]
|
||||||
|
use socket::TcpSocket;
|
||||||
use super::ArpCache;
|
use super::ArpCache;
|
||||||
|
|
||||||
/// An Ethernet network interface.
|
/// An Ethernet network interface.
|
||||||
|
@ -50,11 +56,11 @@ enum Packet<'a> {
|
||||||
None,
|
None,
|
||||||
Arp(ArpRepr),
|
Arp(ArpRepr),
|
||||||
Icmpv4(Ipv4Repr, Icmpv4Repr<'a>),
|
Icmpv4(Ipv4Repr, Icmpv4Repr<'a>),
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
Raw((IpRepr, &'a [u8])),
|
Raw((IpRepr, &'a [u8])),
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
Udp((IpRepr, UdpRepr<'a>)),
|
Udp((IpRepr, UdpRepr<'a>)),
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
Tcp((IpRepr, TcpRepr<'a>))
|
Tcp((IpRepr, TcpRepr<'a>))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,21 +216,21 @@ impl<'a, 'b, 'c, DeviceT> Interface<'a, 'b, 'c, DeviceT>
|
||||||
let &mut Self { ref mut device, ref mut inner } = self;
|
let &mut Self { ref mut device, ref mut inner } = self;
|
||||||
let socket_result =
|
let socket_result =
|
||||||
match *socket {
|
match *socket {
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
Socket::Raw(ref mut socket) =>
|
Socket::Raw(ref mut socket) =>
|
||||||
socket.dispatch(|response| {
|
socket.dispatch(|response| {
|
||||||
let tx_token = device.transmit().ok_or(Error::Exhausted)?;
|
let tx_token = device.transmit().ok_or(Error::Exhausted)?;
|
||||||
device_result = inner.dispatch(tx_token, timestamp, Packet::Raw(response));
|
device_result = inner.dispatch(tx_token, timestamp, Packet::Raw(response));
|
||||||
device_result
|
device_result
|
||||||
}, &caps.checksum),
|
}, &caps.checksum),
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
Socket::Udp(ref mut socket) =>
|
Socket::Udp(ref mut socket) =>
|
||||||
socket.dispatch(|response| {
|
socket.dispatch(|response| {
|
||||||
let tx_token = device.transmit().ok_or(Error::Exhausted)?;
|
let tx_token = device.transmit().ok_or(Error::Exhausted)?;
|
||||||
device_result = inner.dispatch(tx_token, timestamp, Packet::Udp(response));
|
device_result = inner.dispatch(tx_token, timestamp, Packet::Udp(response));
|
||||||
device_result
|
device_result
|
||||||
}),
|
}),
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
Socket::Tcp(ref mut socket) =>
|
Socket::Tcp(ref mut socket) =>
|
||||||
socket.dispatch(timestamp, &caps, |response| {
|
socket.dispatch(timestamp, &caps, |response| {
|
||||||
let tx_token = device.transmit().ok_or(Error::Exhausted)?;
|
let tx_token = device.transmit().ok_or(Error::Exhausted)?;
|
||||||
|
@ -355,11 +361,11 @@ impl<'b, 'c> InterfaceInner<'b, 'c> {
|
||||||
let ip_repr = IpRepr::Ipv4(ipv4_repr);
|
let ip_repr = IpRepr::Ipv4(ipv4_repr);
|
||||||
let ip_payload = ipv4_packet.payload();
|
let ip_payload = ipv4_packet.payload();
|
||||||
|
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
let mut handled_by_raw_socket = false;
|
let mut handled_by_raw_socket = false;
|
||||||
|
|
||||||
// Pass every IP packet to all raw sockets we have registered.
|
// Pass every IP packet to all raw sockets we have registered.
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
for mut raw_socket in sockets.iter_mut().filter_map(RawSocket::downcast) {
|
for mut raw_socket in sockets.iter_mut().filter_map(RawSocket::downcast) {
|
||||||
if !raw_socket.accepts(&ip_repr) { continue }
|
if !raw_socket.accepts(&ip_repr) { continue }
|
||||||
|
|
||||||
|
@ -382,15 +388,15 @@ impl<'b, 'c> InterfaceInner<'b, 'c> {
|
||||||
IpProtocol::Icmp =>
|
IpProtocol::Icmp =>
|
||||||
self.process_icmpv4(ipv4_repr, ip_payload),
|
self.process_icmpv4(ipv4_repr, ip_payload),
|
||||||
|
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
IpProtocol::Udp =>
|
IpProtocol::Udp =>
|
||||||
self.process_udp(sockets, ip_repr, ip_payload),
|
self.process_udp(sockets, ip_repr, ip_payload),
|
||||||
|
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
IpProtocol::Tcp =>
|
IpProtocol::Tcp =>
|
||||||
self.process_tcp(sockets, _timestamp, ip_repr, ip_payload),
|
self.process_tcp(sockets, _timestamp, ip_repr, ip_payload),
|
||||||
|
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
_ if handled_by_raw_socket =>
|
_ if handled_by_raw_socket =>
|
||||||
Ok(Packet::None),
|
Ok(Packet::None),
|
||||||
|
|
||||||
|
@ -453,7 +459,7 @@ impl<'b, 'c> InterfaceInner<'b, 'c> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
fn process_udp<'frame>(&self, sockets: &mut SocketSet,
|
fn process_udp<'frame>(&self, sockets: &mut SocketSet,
|
||||||
ip_repr: IpRepr, ip_payload: &'frame [u8]) ->
|
ip_repr: IpRepr, ip_payload: &'frame [u8]) ->
|
||||||
Result<Packet<'frame>>
|
Result<Packet<'frame>>
|
||||||
|
@ -493,7 +499,7 @@ impl<'b, 'c> InterfaceInner<'b, 'c> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
fn process_tcp<'frame>(&self, sockets: &mut SocketSet, timestamp: u64,
|
fn process_tcp<'frame>(&self, sockets: &mut SocketSet, timestamp: u64,
|
||||||
ip_repr: IpRepr, ip_payload: &'frame [u8]) ->
|
ip_repr: IpRepr, ip_payload: &'frame [u8]) ->
|
||||||
Result<Packet<'frame>>
|
Result<Packet<'frame>>
|
||||||
|
@ -550,13 +556,13 @@ impl<'b, 'c> InterfaceInner<'b, 'c> {
|
||||||
icmpv4_repr.emit(&mut Icmpv4Packet::new(payload), &checksum_caps);
|
icmpv4_repr.emit(&mut Icmpv4Packet::new(payload), &checksum_caps);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
Packet::Raw((ip_repr, raw_packet)) => {
|
Packet::Raw((ip_repr, raw_packet)) => {
|
||||||
self.dispatch_ip(tx_token, timestamp, ip_repr, |_ip_repr, payload| {
|
self.dispatch_ip(tx_token, timestamp, ip_repr, |_ip_repr, payload| {
|
||||||
payload.copy_from_slice(raw_packet);
|
payload.copy_from_slice(raw_packet);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
Packet::Udp((ip_repr, udp_repr)) => {
|
Packet::Udp((ip_repr, udp_repr)) => {
|
||||||
self.dispatch_ip(tx_token, timestamp, ip_repr, |ip_repr, payload| {
|
self.dispatch_ip(tx_token, timestamp, ip_repr, |ip_repr, payload| {
|
||||||
udp_repr.emit(&mut UdpPacket::new(payload),
|
udp_repr.emit(&mut UdpPacket::new(payload),
|
||||||
|
@ -564,7 +570,7 @@ impl<'b, 'c> InterfaceInner<'b, 'c> {
|
||||||
&checksum_caps);
|
&checksum_caps);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
Packet::Tcp((ip_repr, mut tcp_repr)) => {
|
Packet::Tcp((ip_repr, mut tcp_repr)) => {
|
||||||
let caps = self.device_capabilities.clone();
|
let caps = self.device_capabilities.clone();
|
||||||
self.dispatch_ip(tx_token, timestamp, ip_repr, |ip_repr, payload| {
|
self.dispatch_ip(tx_token, timestamp, ip_repr, |ip_repr, payload| {
|
||||||
|
|
|
@ -69,9 +69,9 @@
|
||||||
//! of a packet, it is still logged correctly and in full.
|
//! of a packet, it is still logged correctly and in full.
|
||||||
|
|
||||||
/* XXX compiler bug
|
/* XXX compiler bug
|
||||||
#![cfg(not(any(feature = "proto-raw",
|
#![cfg(not(any(feature = "socket-raw",
|
||||||
feature = "proto-udp",
|
feature = "socket-udp",
|
||||||
feature = "proto-tcp")))]
|
feature = "socket-tcp")))]
|
||||||
compile_error!("at least one socket needs to be enabled"); */
|
compile_error!("at least one socket needs to be enabled"); */
|
||||||
|
|
||||||
extern crate byteorder;
|
extern crate byteorder;
|
||||||
|
|
|
@ -13,23 +13,26 @@
|
||||||
use core::marker::PhantomData;
|
use core::marker::PhantomData;
|
||||||
use wire::IpRepr;
|
use wire::IpRepr;
|
||||||
|
|
||||||
#[cfg(feature = "proto-raw")] mod raw;
|
#[cfg(feature = "socket-raw")]
|
||||||
#[cfg(feature = "proto-udp")] mod udp;
|
mod raw;
|
||||||
#[cfg(feature = "proto-tcp")] mod tcp;
|
#[cfg(feature = "socket-udp")]
|
||||||
|
mod udp;
|
||||||
|
#[cfg(feature = "socket-tcp")]
|
||||||
|
mod tcp;
|
||||||
mod set;
|
mod set;
|
||||||
mod ref_;
|
mod ref_;
|
||||||
|
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
pub use self::raw::{PacketBuffer as RawPacketBuffer,
|
pub use self::raw::{PacketBuffer as RawPacketBuffer,
|
||||||
SocketBuffer as RawSocketBuffer,
|
SocketBuffer as RawSocketBuffer,
|
||||||
RawSocket};
|
RawSocket};
|
||||||
|
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
pub use self::udp::{PacketBuffer as UdpPacketBuffer,
|
pub use self::udp::{PacketBuffer as UdpPacketBuffer,
|
||||||
SocketBuffer as UdpSocketBuffer,
|
SocketBuffer as UdpSocketBuffer,
|
||||||
UdpSocket};
|
UdpSocket};
|
||||||
|
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
pub use self::tcp::{SocketBuffer as TcpSocketBuffer,
|
pub use self::tcp::{SocketBuffer as TcpSocketBuffer,
|
||||||
State as TcpState,
|
State as TcpState,
|
||||||
TcpSocket};
|
TcpSocket};
|
||||||
|
@ -52,11 +55,11 @@ pub(crate) use self::ref_::Session as SocketSession;
|
||||||
/// [SocketSet::get]: struct.SocketSet.html#method.get
|
/// [SocketSet::get]: struct.SocketSet.html#method.get
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum Socket<'a, 'b: 'a> {
|
pub enum Socket<'a, 'b: 'a> {
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
Raw(RawSocket<'a, 'b>),
|
Raw(RawSocket<'a, 'b>),
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
Udp(UdpSocket<'a, 'b>),
|
Udp(UdpSocket<'a, 'b>),
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
Tcp(TcpSocket<'a>),
|
Tcp(TcpSocket<'a>),
|
||||||
#[doc(hidden)]
|
#[doc(hidden)]
|
||||||
__Nonexhaustive(PhantomData<(&'a (), &'b ())>)
|
__Nonexhaustive(PhantomData<(&'a (), &'b ())>)
|
||||||
|
@ -65,11 +68,11 @@ pub enum Socket<'a, 'b: 'a> {
|
||||||
macro_rules! dispatch_socket {
|
macro_rules! dispatch_socket {
|
||||||
($self_:expr, |$socket:ident [$( $mut_:tt )*]| $code:expr) => ({
|
($self_:expr, |$socket:ident [$( $mut_:tt )*]| $code:expr) => ({
|
||||||
match $self_ {
|
match $self_ {
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
&$( $mut_ )* Socket::Raw(ref $( $mut_ )* $socket) => $code,
|
&$( $mut_ )* Socket::Raw(ref $( $mut_ )* $socket) => $code,
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
&$( $mut_ )* Socket::Udp(ref $( $mut_ )* $socket) => $code,
|
&$( $mut_ )* Socket::Udp(ref $( $mut_ )* $socket) => $code,
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
&$( $mut_ )* Socket::Tcp(ref $( $mut_ )* $socket) => $code,
|
&$( $mut_ )* Socket::Tcp(ref $( $mut_ )* $socket) => $code,
|
||||||
&$( $mut_ )* Socket::__Nonexhaustive(_) => unreachable!()
|
&$( $mut_ )* Socket::__Nonexhaustive(_) => unreachable!()
|
||||||
}
|
}
|
||||||
|
@ -117,9 +120,9 @@ macro_rules! from_socket {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
from_socket!(RawSocket<'a, 'b>, Raw);
|
from_socket!(RawSocket<'a, 'b>, Raw);
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
from_socket!(UdpSocket<'a, 'b>, Udp);
|
from_socket!(UdpSocket<'a, 'b>, Udp);
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
from_socket!(TcpSocket<'a>, Tcp);
|
from_socket!(TcpSocket<'a>, Tcp);
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
use core::ops::{Deref, DerefMut};
|
use core::ops::{Deref, DerefMut};
|
||||||
|
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
use socket::RawSocket;
|
use socket::RawSocket;
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
use socket::UdpSocket;
|
use socket::UdpSocket;
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
use socket::TcpSocket;
|
use socket::TcpSocket;
|
||||||
|
|
||||||
/// A trait for tracking a socket usage session.
|
/// A trait for tracking a socket usage session.
|
||||||
|
@ -17,11 +17,11 @@ pub trait Session {
|
||||||
fn finish(&mut self) {}
|
fn finish(&mut self) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
impl<'a, 'b> Session for RawSocket<'a, 'b> {}
|
impl<'a, 'b> Session for RawSocket<'a, 'b> {}
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
impl<'a, 'b> Session for UdpSocket<'a, 'b> {}
|
impl<'a, 'b> Session for UdpSocket<'a, 'b> {}
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
impl<'a> Session for TcpSocket<'a> {}
|
impl<'a> Session for TcpSocket<'a> {}
|
||||||
|
|
||||||
/// A smart pointer to a socket.
|
/// A smart pointer to a socket.
|
||||||
|
|
|
@ -2,7 +2,8 @@ use core::{fmt, slice};
|
||||||
use managed::ManagedSlice;
|
use managed::ManagedSlice;
|
||||||
|
|
||||||
use super::{Socket, SocketRef, AnySocket};
|
use super::{Socket, SocketRef, AnySocket};
|
||||||
#[cfg(feature = "proto-tcp")] use super::TcpState;
|
#[cfg(feature = "socket-tcp")]
|
||||||
|
use super::TcpState;
|
||||||
|
|
||||||
/// An item of a socket set.
|
/// An item of a socket set.
|
||||||
///
|
///
|
||||||
|
@ -140,13 +141,13 @@ impl<'a, 'b: 'a, 'c: 'a + 'b> Set<'a, 'b, 'c> {
|
||||||
let mut may_remove = false;
|
let mut may_remove = false;
|
||||||
if let &mut Some(Item { refs: 0, ref mut socket }) = item {
|
if let &mut Some(Item { refs: 0, ref mut socket }) = item {
|
||||||
match socket {
|
match socket {
|
||||||
#[cfg(feature = "proto-raw")]
|
#[cfg(feature = "socket-raw")]
|
||||||
&mut Socket::Raw(_) =>
|
&mut Socket::Raw(_) =>
|
||||||
may_remove = true,
|
may_remove = true,
|
||||||
#[cfg(feature = "proto-udp")]
|
#[cfg(feature = "socket-udp")]
|
||||||
&mut Socket::Udp(_) =>
|
&mut Socket::Udp(_) =>
|
||||||
may_remove = true,
|
may_remove = true,
|
||||||
#[cfg(feature = "proto-tcp")]
|
#[cfg(feature = "socket-tcp")]
|
||||||
&mut Socket::Tcp(ref mut socket) =>
|
&mut Socket::Tcp(ref mut socket) =>
|
||||||
if socket.state() == TcpState::Closed {
|
if socket.state() == TcpState::Closed {
|
||||||
may_remove = true
|
may_remove = true
|
||||||
|
|
Loading…
Reference in New Issue