File tree Expand file tree Collapse file tree 2 files changed +24
-6
lines changed
compio-driver/src/iocp/cp Expand file tree Collapse file tree 2 files changed +24
-6
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use std::{
66 time:: Duration ,
77} ;
88
9+ use compio_log:: * ;
910#[ cfg( not( feature = "once_cell_try" ) ) ]
1011use once_cell:: sync:: OnceCell as OnceLock ;
1112use windows_sys:: Win32 :: System :: IO :: PostQueuedCompletionStatus ;
@@ -53,21 +54,30 @@ fn iocp_port() -> io::Result<&'static GlobalPort> {
5354fn iocp_start ( ) -> io:: Result < ( ) > {
5455 let port = iocp_port ( ) ?;
5556 std:: thread:: spawn ( move || {
57+ instrument ! ( compio_log:: Level :: TRACE , "iocp_start" ) ;
5658 loop {
5759 for entry in port. port . poll_raw ( None ) ? {
5860 // Any thin pointer is OK because we don't use the type of opcode.
5961 let overlapped_ptr: * mut Overlapped < ( ) > = entry. lpOverlapped . cast ( ) ;
6062 let overlapped = unsafe { & * overlapped_ptr } ;
61- syscall ! (
63+ if let Err ( e ) = syscall ! (
6264 BOOL ,
6365 PostQueuedCompletionStatus (
6466 overlapped. driver as _,
6567 entry. dwNumberOfBytesTransferred,
6668 entry. lpCompletionKey,
6769 entry. lpOverlapped,
6870 )
69- )
70- . ok ( ) ;
71+ ) {
72+ error ! (
73+ "fail to dispatch entry ({}, {}, {:p}) to driver {:p}: {:?}" ,
74+ entry. dwNumberOfBytesTransferred,
75+ entry. lpCompletionKey,
76+ entry. lpOverlapped,
77+ overlapped. driver,
78+ e
79+ ) ;
80+ }
7181 }
7282 }
7383 #[ allow( unreachable_code) ]
Original file line number Diff line number Diff line change @@ -143,16 +143,24 @@ impl CompletionPort {
143143 if let Some ( current_driver) = current_driver {
144144 if overlapped. driver != current_driver {
145145 // Repose the entry to correct port.
146- syscall ! (
146+ if let Err ( e ) = syscall ! (
147147 BOOL ,
148148 PostQueuedCompletionStatus (
149149 overlapped. driver as _,
150150 entry. dwNumberOfBytesTransferred,
151151 entry. lpCompletionKey,
152152 entry. lpOverlapped,
153153 )
154- )
155- . ok ( ) ;
154+ ) {
155+ error ! (
156+ "fail to repost entry ({}, {}, {:p}) to driver {:p}: {:?}" ,
157+ entry. dwNumberOfBytesTransferred,
158+ entry. lpCompletionKey,
159+ entry. lpOverlapped,
160+ overlapped. driver,
161+ e
162+ ) ;
163+ }
156164 }
157165 }
158166 let res = if matches ! (
You can’t perform that action at this time.
0 commit comments