net: Disable nagle algo & Set keep_alive duration
This commit is contained in:
parent
f303ab639a
commit
554f292cab
|
@ -6,7 +6,7 @@ use log::{debug, info};
|
|||
use smoltcp::{
|
||||
iface::{
|
||||
self, Interface, SocketHandle, SocketSet, SocketStorage
|
||||
}, socket::tcp::{Socket, SocketBuffer, State}, time::Instant, wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv4Cidr}
|
||||
}, socket::tcp::{Socket, SocketBuffer, State}, time::{Instant, Duration}, wire::{EthernetAddress, IpAddress, IpCidr, Ipv4Address, Ipv4Cidr}
|
||||
};
|
||||
use stm32_eth::{
|
||||
Parts, EthPins, PartsIn,
|
||||
|
@ -160,6 +160,8 @@ impl ServerHandle {
|
|||
for i in 0..NUM_OF_SOCKETS {
|
||||
let socket = socket_set.get_mut::<Socket>(tcp_handles[i]);
|
||||
socket.listen(socket_addr).ok();
|
||||
socket.set_keep_alive(Some(Duration::from_secs(1)));
|
||||
socket.set_nagle_enabled(false);
|
||||
}
|
||||
|
||||
iface.poll(Instant::from_millis(i64::from(sys_timer::now())), &mut &mut dma, &mut socket_set);
|
||||
|
|
Loading…
Reference in New Issue