@@ -16,11 +16,12 @@ use smoltcp::{
1616 wire:: { IpEndpoint , IpListenEndpoint } ,
1717} ;
1818
19- use super :: { LISTEN_TABLE , SOCKET_SET } ;
2019use crate :: {
21- RecvFlags , RecvOptions , SERVICE , SendOptions , Shutdown , Socket , SocketAddrEx , SocketOps ,
20+ LISTEN_TABLE , RecvFlags , RecvOptions , SOCKET_SET , SendOptions , Shutdown , Socket , SocketAddrEx ,
21+ SocketOps ,
2222 consts:: { TCP_RX_BUF_LEN , TCP_TX_BUF_LEN } ,
2323 general:: GeneralOptions ,
24+ get_service,
2425 options:: { Configurable , GetSocketOption , SetSocketOption } ,
2526 poll_interfaces,
2627 state:: * ,
@@ -71,7 +72,7 @@ impl TcpSocket {
7172 result. with_smol_socket ( |socket| {
7273 result
7374 . general
74- . set_device_mask ( SERVICE . lock ( ) . device_mask_for ( & socket. get_bound_endpoint ( ) ) ) ;
75+ . set_device_mask ( get_service ( ) . device_mask_for ( & socket. get_bound_endpoint ( ) ) ) ;
7576 } ) ;
7677 result
7778 }
@@ -232,7 +233,7 @@ impl SocketOps for TcpSocket {
232233 } ;
233234 socket. set_bound_endpoint ( endpoint) ;
234235 self . general
235- . set_device_mask ( SERVICE . lock ( ) . device_mask_for ( & endpoint) ) ;
236+ . set_device_mask ( get_service ( ) . device_mask_for ( & endpoint) ) ;
236237 Ok ( ( ) )
237238 } ) ?;
238239 debug ! ( "TCP socket {}: binding to {}" , self . handle, local_addr) ;
@@ -260,7 +261,7 @@ impl SocketOps for TcpSocket {
260261 self . with_smol_socket ( |socket| socket. get_bound_endpoint ( ) ) ;
261262 if bound_endpoint. addr . is_none ( ) {
262263 bound_endpoint. addr =
263- Some ( SERVICE . lock ( ) . get_source_address ( & remote_endpoint. addr ) ) ;
264+ Some ( get_service ( ) . get_source_address ( & remote_endpoint. addr ) ) ;
264265 }
265266 if bound_endpoint. port == 0 {
266267 bound_endpoint. port = get_ephemeral_port ( ) ?;
@@ -273,10 +274,10 @@ impl SocketOps for TcpSocket {
273274 self . with_smol_socket ( |socket| {
274275 socket. set_bound_endpoint ( bound_endpoint) ;
275276 self . general
276- . set_device_mask ( SERVICE . lock ( ) . device_mask_for ( & bound_endpoint) ) ;
277+ . set_device_mask ( get_service ( ) . device_mask_for ( & bound_endpoint) ) ;
277278 socket
278279 . connect (
279- crate :: SERVICE . lock ( ) . iface . context ( ) ,
280+ get_service ( ) . iface . context ( ) ,
280281 remote_endpoint,
281282 bound_endpoint,
282283 )
0 commit comments