Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/GameQ/Query/Native.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,16 @@ public function write($data)
$this->create();
}

if (!is_resource($this->socket)) {
throw new Exception('Socket is not a valid resource');
}

// Send the packet
return fwrite($this->socket, $data);
$bytes = @fwrite($this->socket, $data);
if ($bytes === false) {
throw new Exception('Failed to write to socket');
}
return $bytes;
} catch (\Exception $e) {
throw new Exception($e->getMessage(), $e->getCode(), $e);
}
Expand Down
2 changes: 1 addition & 1 deletion src/GameQ/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ public function getJoinLink()
}

// Fill the template to build the final joinLink
return sprintf($joinLink, $this->ip, $this->portClient());
return !isset($this->join_link) ? '' : sprintf($joinLink, $this->ip, $this->portClient());
}

// Socket holding
Expand Down