File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -298,7 +298,9 @@ impl Socket {
298298 }
299299 }
300300
301- async fn accept ( & mut self ) -> io:: Result < ( Socket , Endpoint ) > {
301+ async fn accept (
302+ & mut self ,
303+ ) -> io:: Result < ( Arc < async_lock:: RwLock < dyn ObjectInterface > > , Endpoint ) > {
302304 if !self . is_listen {
303305 self . listen ( DEFAULT_BACKLOG ) . await ?;
304306 }
@@ -357,7 +359,7 @@ impl Socket {
357359 is_listen : false ,
358360 } ;
359361
360- Ok ( ( socket, endpoint) )
362+ Ok ( ( Arc :: new ( async_lock :: RwLock :: new ( socket) ) , endpoint) )
361363 }
362364
363365 async fn getpeername ( & self ) -> io:: Result < Option < Endpoint > > {
@@ -499,8 +501,7 @@ impl ObjectInterface for Socket {
499501 async fn accept (
500502 & mut self ,
501503 ) -> io:: Result < ( Arc < async_lock:: RwLock < dyn ObjectInterface > > , Endpoint ) > {
502- let ( socket, endpoint) = self . accept ( ) . await ?;
503- Ok ( ( Arc :: new ( async_lock:: RwLock :: new ( socket) ) , endpoint) )
504+ self . accept ( ) . await
504505 }
505506
506507 async fn getpeername ( & self ) -> io:: Result < Option < Endpoint > > {
Original file line number Diff line number Diff line change @@ -236,7 +236,9 @@ impl Socket {
236236 Ok ( ( ) )
237237 }
238238
239- async fn accept ( & mut self ) -> io:: Result < ( NullSocket , Endpoint ) > {
239+ async fn accept (
240+ & mut self ,
241+ ) -> io:: Result < ( Arc < async_lock:: RwLock < dyn ObjectInterface > > , Endpoint ) > {
240242 let port = self . port ;
241243 let cid = self . cid ;
242244
@@ -292,7 +294,10 @@ impl Socket {
292294 } )
293295 . await ?;
294296
295- Ok ( ( NullSocket :: new ( ) , Endpoint :: Vsock ( endpoint) ) )
297+ Ok ( (
298+ Arc :: new ( async_lock:: RwLock :: new ( NullSocket :: new ( ) ) ) ,
299+ Endpoint :: Vsock ( endpoint) ,
300+ ) )
296301 }
297302
298303 async fn shutdown ( & self , _how : i32 ) -> io:: Result < ( ) > {
@@ -445,8 +450,7 @@ impl ObjectInterface for Socket {
445450 async fn accept (
446451 & mut self ,
447452 ) -> io:: Result < ( Arc < async_lock:: RwLock < dyn ObjectInterface > > , Endpoint ) > {
448- let ( handle, endpoint) = self . accept ( ) . await ?;
449- Ok ( ( Arc :: new ( async_lock:: RwLock :: new ( handle) ) , endpoint) )
453+ self . accept ( ) . await
450454 }
451455
452456 async fn getpeername ( & self ) -> io:: Result < Option < Endpoint > > {
You can’t perform that action at this time.
0 commit comments