@@ -191,25 +191,25 @@ fn send_event(sockets: &smoltcp::iface::SocketSet) -> Result<(), SystemError> {
191
191
for ( handle, socket_type) in sockets. iter ( ) {
192
192
let handle_guard = HANDLE_MAP . read_irqsave ( ) ;
193
193
let global_handle = GlobalSocketHandle :: new_smoltcp_handle ( handle) ;
194
- let item = handle_guard. get ( & global_handle) ;
194
+ let item: Option < & super :: socket :: SocketHandleItem > = handle_guard. get ( & global_handle) ;
195
195
if item. is_none ( ) {
196
196
continue ;
197
197
}
198
198
199
199
let handle_item = item. unwrap ( ) ;
200
+ let posix_item = handle_item. posix_item ( ) ;
201
+ if posix_item. is_none ( ) {
202
+ continue ;
203
+ }
204
+ let posix_item = posix_item. unwrap ( ) ;
200
205
201
206
// 获取socket上的事件
202
- let mut events =
203
- SocketPollMethod :: poll ( socket_type, handle_item. shutdown_type ( ) ) . bits ( ) as u64 ;
207
+ let mut events = SocketPollMethod :: poll ( socket_type, handle_item) . bits ( ) as u64 ;
204
208
205
209
// 分发到相应类型socket处理
206
210
match socket_type {
207
211
smoltcp:: socket:: Socket :: Raw ( _) | smoltcp:: socket:: Socket :: Udp ( _) => {
208
- handle_guard
209
- . get ( & global_handle)
210
- . unwrap ( )
211
- . wait_queue
212
- . wakeup_any ( events) ;
212
+ posix_item. wakeup_any ( events) ;
213
213
}
214
214
smoltcp:: socket:: Socket :: Icmp ( _) => unimplemented ! ( "Icmp socket hasn't unimplemented" ) ,
215
215
smoltcp:: socket:: Socket :: Tcp ( inner_socket) => {
@@ -222,17 +222,14 @@ fn send_event(sockets: &smoltcp::iface::SocketSet) -> Result<(), SystemError> {
222
222
if inner_socket. state ( ) == smoltcp:: socket:: tcp:: State :: CloseWait {
223
223
events |= EPollEventType :: EPOLLHUP . bits ( ) as u64 ;
224
224
}
225
- handle_guard
226
- . get ( & global_handle)
227
- . unwrap ( )
228
- . wait_queue
229
- . wakeup_any ( events) ;
225
+
226
+ posix_item. wakeup_any ( events) ;
230
227
}
231
228
smoltcp:: socket:: Socket :: Dhcpv4 ( _) => { }
232
229
smoltcp:: socket:: Socket :: Dns ( _) => unimplemented ! ( "Dns socket hasn't unimplemented" ) ,
233
230
}
234
231
EventPoll :: wakeup_epoll (
235
- & handle_item . epitems ,
232
+ & posix_item . epitems ,
236
233
EPollEventType :: from_bits_truncate ( events as u32 ) ,
237
234
) ?;
238
235
drop ( handle_guard) ;
0 commit comments