Skip to content

Commit

Permalink
Add configurable socket/udp connection details based on new extension.
Browse files Browse the repository at this point in the history
  • Loading branch information
beberlei committed Jan 2, 2015
1 parent c296bb6 commit 4d26e65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/main/QafooLabs/Profiler.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,10 @@ private static function init($apiKey)
}

if (self::$backend === null) {
self::$backend = new Profiler\NetworkBackend();
self::$backend = new Profiler\NetworkBackend(
ini_get('qafooprofiler.connection') ?: 'unix:///tmp/qprofd.sock',
ini_get('qafooprofiler.udp_connection') ?: '127.0.0.1:8135'
);
}

self::$profiling = false;
Expand Down
4 changes: 2 additions & 2 deletions src/main/QafooLabs/Profiler/NetworkBackend.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class NetworkBackend implements Backend
private $socketFile;
private $udp;

public function __construct($socketFile = "/tmp/qprofd.sock", $udp = "127.0.0.1:8135")
public function __construct($socketFile = "unix:///tmp/qprofd.sock", $udp = "127.0.0.1:8135")
{
$this->socketFile = $socketFile;
$this->udp = $udp;
Expand All @@ -40,7 +40,7 @@ public function storeProfile(array $data)
private function storeThroughFileSocket($dataType, array $data)
{
set_error_handler(array(__CLASS__, "ignoreErrorsHandler"));
$fp = stream_socket_client("unix://" . $this->socketFile);
$fp = stream_socket_client($this->socketFile);

if ($fp == false) {
restore_error_handler();
Expand Down

0 comments on commit 4d26e65

Please sign in to comment.