@@ -475,66 +475,63 @@ impl Drop for Socket {
475475}
476476
477477#[ async_trait]
478- impl ObjectInterface for async_lock :: RwLock < Socket > {
478+ impl ObjectInterface for Socket {
479479 async fn poll ( & self , event : PollEvent ) -> io:: Result < PollEvent > {
480- self . read ( ) . await . poll ( event) . await
480+ self . poll ( event) . await
481481 }
482482
483483 async fn read ( & self , buffer : & mut [ u8 ] ) -> io:: Result < usize > {
484- self . read ( ) . await . read ( buffer) . await
484+ self . read ( buffer) . await
485485 }
486486
487487 async fn write ( & self , buffer : & [ u8 ] ) -> io:: Result < usize > {
488- self . read ( ) . await . write ( buffer) . await
488+ self . write ( buffer) . await
489489 }
490490
491491 async fn bind ( & mut self , endpoint : ListenEndpoint ) -> io:: Result < ( ) > {
492- self . write ( ) . await . bind ( endpoint) . await
492+ self . bind ( endpoint) . await
493493 }
494494
495495 async fn connect ( & mut self , endpoint : Endpoint ) -> io:: Result < ( ) > {
496- self . write ( ) . await . connect ( endpoint) . await
496+ self . connect ( endpoint) . await
497497 }
498498
499499 async fn accept (
500500 & mut self ,
501501 ) -> io:: Result < ( Arc < async_lock:: RwLock < dyn ObjectInterface > > , Endpoint ) > {
502- let ( socket, endpoint) = self . write ( ) . await . accept ( ) . await ?;
503- Ok ( (
504- Arc :: new ( async_lock:: RwLock :: new ( async_lock:: RwLock :: new ( socket) ) ) ,
505- endpoint,
506- ) )
502+ let ( socket, endpoint) = self . accept ( ) . await ?;
503+ Ok ( ( Arc :: new ( async_lock:: RwLock :: new ( socket) ) , endpoint) )
507504 }
508505
509506 async fn getpeername ( & self ) -> io:: Result < Option < Endpoint > > {
510- self . read ( ) . await . getpeername ( ) . await
507+ self . getpeername ( ) . await
511508 }
512509
513510 async fn getsockname ( & self ) -> io:: Result < Option < Endpoint > > {
514- self . read ( ) . await . getsockname ( ) . await
511+ self . getsockname ( ) . await
515512 }
516513
517514 async fn listen ( & mut self , backlog : i32 ) -> io:: Result < ( ) > {
518- self . write ( ) . await . listen ( backlog) . await
515+ self . listen ( backlog) . await
519516 }
520517
521518 async fn setsockopt ( & self , opt : SocketOption , optval : bool ) -> io:: Result < ( ) > {
522- self . read ( ) . await . setsockopt ( opt, optval) . await
519+ self . setsockopt ( opt, optval) . await
523520 }
524521
525522 async fn getsockopt ( & self , opt : SocketOption ) -> io:: Result < bool > {
526- self . read ( ) . await . getsockopt ( opt) . await
523+ self . getsockopt ( opt) . await
527524 }
528525
529526 async fn shutdown ( & self , how : i32 ) -> io:: Result < ( ) > {
530- self . read ( ) . await . shutdown ( how) . await
527+ self . shutdown ( how) . await
531528 }
532529
533530 async fn status_flags ( & self ) -> io:: Result < fd:: StatusFlags > {
534- self . read ( ) . await . status_flags ( ) . await
531+ self . status_flags ( ) . await
535532 }
536533
537534 async fn set_status_flags ( & mut self , status_flags : fd:: StatusFlags ) -> io:: Result < ( ) > {
538- self . write ( ) . await . set_status_flags ( status_flags) . await
535+ self . set_status_flags ( status_flags) . await
539536 }
540537}
0 commit comments