File tree Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Expand file tree Collapse file tree 2 files changed +3
-8
lines changed Original file line number Diff line number Diff line change @@ -118,8 +118,7 @@ impl Proactor {
118118 /// attached to one driver, and could only be attached once, even if you
119119 /// `try_clone` it. It will cause unexpected result to attach the handle
120120 /// with one driver and push an op to another driver.
121- /// * io-uring: it will do nothing and return `Ok(())`.
122- /// * polling: it will initialize the internal interest queue for the fd.
121+ /// * io-uring/polling: it will do nothing and return `Ok(())`.
123122 pub fn attach ( & mut self , fd : RawFd ) -> io:: Result < ( ) > {
124123 self . driver . attach ( fd)
125124 }
Original file line number Diff line number Diff line change @@ -139,10 +139,7 @@ impl Driver {
139139 Ok ( false )
140140 } else {
141141 let need_add = !self . registry . contains_key ( & arg. fd ) ;
142- let queue = self
143- . registry
144- . get_mut ( & arg. fd )
145- . expect ( "the fd should be attached" ) ;
142+ let queue = self . registry . entry ( arg. fd ) . or_default ( ) ;
146143 queue. push_interest ( user_data, arg. interest ) ;
147144 // We use fd as the key.
148145 let event = queue. event ( arg. fd as usize ) ;
@@ -230,8 +227,7 @@ impl Driver {
230227 Ok ( ( ) )
231228 }
232229
233- pub fn attach ( & mut self , fd : RawFd ) -> io:: Result < ( ) > {
234- self . registry . entry ( fd) . or_default ( ) ;
230+ pub fn attach ( & mut self , _fd : RawFd ) -> io:: Result < ( ) > {
235231 Ok ( ( ) )
236232 }
237233
You can’t perform that action at this time.
0 commit comments