smoltcp: bump to 0.7.0

master
occheung 2021-07-15 17:36:32 +08:00
parent fd48031567
commit 10d9adaa8e
4 changed files with 21 additions and 21 deletions

View File

@ -26,7 +26,7 @@ default-features = true
features = [ "heapless" ]
[dependencies.smoltcp]
git = "https://github.com/smoltcp-rs/smoltcp.git"
version = "0.7.0"
default-features = false
features = ["ethernet", "proto-ipv4", "proto-ipv6", "socket-tcp", "alloc"]

View File

@ -6,8 +6,8 @@ use net::phy::Device;
use net::iface::EthernetInterface;
use net::time::Instant;
pub struct TlsSocketSet<'a, 'b, 'c> {
tls_sockets: ManagedSlice<'a, Option<TlsSocket<'a, 'b, 'c>>>
pub struct TlsSocketSet<'a> {
tls_sockets: ManagedSlice<'a, Option<TlsSocket<'a>>>
}
#[derive(Clone, Copy, Debug)]
@ -19,17 +19,17 @@ impl TlsSocketHandle {
}
}
impl<'a, 'b, 'c> TlsSocketSet<'a, 'b, 'c> {
impl<'a> TlsSocketSet<'a> {
pub fn new<T>(tls_sockets: T) -> Self
where
T: Into<ManagedSlice<'a, Option<TlsSocket<'a, 'b, 'c>>>>
T: Into<ManagedSlice<'a, Option<TlsSocket<'a>>>>
{
Self {
tls_sockets: tls_sockets.into()
}
}
pub fn add(&mut self, socket: TlsSocket<'a, 'b, 'c>) -> TlsSocketHandle
pub fn add(&mut self, socket: TlsSocket<'a>) -> TlsSocketHandle
{
for (index, slot) in self.tls_sockets.iter_mut().enumerate() {
if slot.is_none() {
@ -51,7 +51,7 @@ impl<'a, 'b, 'c> TlsSocketSet<'a, 'b, 'c> {
}
}
pub fn get(&mut self, handle: TlsSocketHandle) -> &mut TlsSocket<'a, 'b, 'c> {
pub fn get(&mut self, handle: TlsSocketHandle) -> &mut TlsSocket<'a> {
self.tls_sockets[handle.0].as_mut().unwrap()
}

View File

@ -21,14 +21,14 @@ pub enum NetworkError {
}
// Structure for implementaion TcpStack interface
pub struct NetworkStack<'a, 'b, 'c> {
sockets: RefCell<SocketSet<'a, 'b, 'c>>,
pub struct NetworkStack<'a> {
sockets: RefCell<SocketSet<'a>>,
next_port: RefCell<u16>,
unused_handles: RefCell<Vec<SocketHandle, U16>>
}
impl<'a, 'b, 'c> NetworkStack<'a, 'b, 'c> {
pub fn new(sockets: SocketSet<'a, 'b, 'c>) -> Self {
impl<'a> NetworkStack<'a> {
pub fn new(sockets: SocketSet<'a>) -> Self {
let mut vec = Vec::new();
log::info!("socket set size: {:?}", sockets.len());
for index in 0..sockets.len() {
@ -67,7 +67,7 @@ impl<'a, 'b, 'c> NetworkStack<'a, 'b, 'c> {
}
}
impl<'a, 'b, 'c> TcpStack for NetworkStack<'a, 'b, 'c> {
impl<'a> TcpStack for NetworkStack<'a> {
type TcpSocket = SocketHandle;
type Error = NetworkError;

View File

@ -59,22 +59,22 @@ pub(crate) enum TlsState {
SERVER_CONNECTED
}
pub struct TlsSocket<'a, 'b, 'c>
pub struct TlsSocket<'a>
{
// Locally owned SocketSet, solely containing 1 TCP socket
sockets: SocketSet<'a, 'b, 'c>,
sockets: SocketSet<'a>,
tcp_handle: SocketHandle,
rng: &'b mut dyn crate::TlsRng,
session: RefCell<Session<'b>>,
rng: &'a mut dyn crate::TlsRng,
session: RefCell<Session<'a>>,
}
impl<'a, 'b, 'c> TlsSocket<'a, 'b, 'c> {
impl<'a> TlsSocket<'a> {
pub fn new(
tcp_socket: TcpSocket<'b>,
rng: &'b mut dyn crate::TlsRng,
tcp_socket: TcpSocket<'a>,
rng: &'a mut dyn crate::TlsRng,
certificate_with_key: Option<(
crate::session::CertificatePrivateKey,
Vec<&'b [u8]>
Vec<&'a [u8]>
)>
) -> Self
{
@ -2095,7 +2095,7 @@ impl<'a, 'b, 'c> TlsSocket<'a, 'b, 'c> {
}
use core::fmt;
impl<'a, 'b, 'c> fmt::Write for TlsSocket<'a, 'b, 'c> {
impl<'a> fmt::Write for TlsSocket<'a> {
fn write_str(&mut self, slice: &str) -> fmt::Result {
let slice = slice.as_bytes();
if self.send_slice(slice) == Ok(slice.len()) {