function _load_items( $sock, &$ret ) {
while ( 1 ) {
$decl = fgets( $sock );
- if ( $decl == "END\r\n" ) {
+ if( $decl === false ) {
+ $this->_debugprint( "Error reading socket for a memcached response\n" );
+ return 0;
+ } elseif ( $decl == "END\r\n" ) {
return true;
} elseif ( preg_match( '/^VALUE (\S+) (\d+) (\d+)\r\n$/', $decl, $match ) ) {
list( $rkey, $flags, $len ) = array( $match[1], $match[2], $match[3] );
}
} else {
- $this->_debugprint( "Error parsing memcached response\n" );
+ $peer = $peerAddress = $peerPort = '';
+ $gotPeer = socket_getpeername( $sock, $peerAddress, $peerPort );
+ if( $gotPeer ) {
+ $peer = " from [$peerAddress:$peerPort";
+ }
+ $this->_debugprint( "Error parsing memcached response{$peer}\n" );
return 0;
}
}