Changeset 8217

Show
Ignore:
Timestamp:
08/27/09 13:50:33 (7 months ago)
Author:
p_lindheimer
Message:

closes #2880 fix lower timeouts in phpagi-asmanager that gets called from agi scripts, does not effect the copy called by the GUI code

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • freepbx/branches/2.6/amp_conf/agi-bin/phpagi-asmanager.php

    r5265 r8217  
    225225      } 
    226226 
    227       // connect the socket 
     227      // connect the socket, set a 10 second timeout for the connection, this gives us plenty of time to connect 
    228228      $errno = $errstr = NULL; 
    229       $this->socket = @fsockopen($this->server, $this->port, $errno, $errstr); 
     229      $this->socket = @fsockopen($this->server, $this->port, $errno, $errstr, 10); 
    230230      if($this->socket == false) 
    231231      { 
    232232        $this->log("Unable to connect to manager {$this->server}:{$this->port} ($errno): $errstr"); 
    233233        return false; 
    234       } 
    235  
     234      } else 
     235      // Set a 2 second timeout for read/write commands 
     236      stream_set_timeout($this->socket, 2); 
     237         
    236238      // read the header 
    237239      $str = fgets($this->socket); 
     
    252254      { 
    253255        $this->log("Failed to login."); 
    254         $this->disconnect(); 
     256        $this->disconnect(TRUE); 
    255257        return false; 
    256258      } 
     
    263265    * @example examples/sip_show_peer.php Get information about a sip peer 
    264266    */ 
    265     function disconnect() 
    266     { 
     267    function disconnect($dontlogoff=NULL) 
     268    { 
     269      if (!$dontlogoff) 
    267270      $this->logoff(); 
    268271      fclose($this->socket);