File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -59,8 +59,16 @@ public function write($data)
5959 $ this ->create ();
6060 }
6161
62+ if (!is_resource ($ this ->socket )) {
63+ throw new Exception ('Socket is not a valid resource ' );
64+ }
65+
6266 // Send the packet
63- return fwrite ($ this ->socket , $ data );
67+ $ bytes = @fwrite ($ this ->socket , $ data );
68+ if ($ bytes === false ) {
69+ throw new Exception ('Failed to write to socket ' );
70+ }
71+ return $ bytes ;
6472 } catch (\Exception $ e ) {
6573 throw new Exception ($ e ->getMessage (), $ e ->getCode (), $ e );
6674 }
Original file line number Diff line number Diff line change @@ -322,7 +322,7 @@ public function getJoinLink()
322322 }
323323
324324 // Fill the template to build the final joinLink
325- return sprintf ($ joinLink , $ this ->ip , $ this ->portClient ());
325+ return ! isset ( $ this -> join_link ) ? '' : sprintf ($ joinLink , $ this ->ip , $ this ->portClient ());
326326 }
327327
328328 // Socket holding
You can’t perform that action at this time.
0 commit comments