File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -245,8 +245,11 @@ protected function getWebsocketConnections(): array
245245     */ 
246246    public  function  shouldPushToDescriptor (int  $ fdbool 
247247    {
248-         return  $ this server ->exist ($ fd
249-             && ($ this broadcast  && $ this sender  !== (int ) $ fd
248+         if  (! $ this server ->exist ($ fd
249+             return  false ;
250+         }
251+ 
252+         return  $ this broadcast  ? $ this sender  !== (int ) $ fdtrue ;
250253    }
251254
252255    /** 
Original file line number Diff line number Diff line change @@ -115,7 +115,7 @@ public function testShouldPushToDescriptor()
115115        $ servermock (Server::class);
116116        $ servershouldReceive ('exist ' )
117117            ->with ($ fd1 )
118-             ->twice ( )
118+             ->times ( 3 )
119119            ->andReturn (true );
120120
121121        $ pushermake ([
@@ -141,5 +141,17 @@ public function testShouldPushToDescriptor()
141141        ], $ server
142142
143143        $ this assertFalse ($ pushershouldPushToDescriptor ($ fd
144+ 
145+         $ pushermake ([
146+             'opcode '  => 1 ,
147+             'sender '  => 1 ,
148+             'fds '  => [],
149+             'broadcast '  => false ,
150+             'assigned '  => false ,
151+             'event '  => 'event ' ,
152+             'message '  => 'message ' 
153+         ], $ server
154+ 
155+         $ this assertTrue ($ pushershouldPushToDescriptor ($ fd
144156    }
145157}
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments