return;
}
- wfDebugLog( 'squid', __METHOD__ . ': ' . implode( ' ', $urlArr ) . "\n" );
+ wfDebugLog( 'squid', __METHOD__ . ': ' . implode( ' ', $urlArr ) );
if ( $wgHTCPRouting ) {
self::HTCPPurge( $urlArr );
if ( !$conn ) {
$errstr = socket_strerror( socket_last_error() );
wfDebugLog( 'squid', __METHOD__ .
- ": Error opening UDP socket: $errstr\n" );
+ ": Error opening UDP socket: $errstr" );
wfProfileOut( __METHOD__ );
return;
// Remove duplicate URLs from collection
$urlArr = array_unique( $urlArr );
+ // Get sequential trx IDs for packet loss counting
+ $ids = UIDGenerator::newSequentialPerNodeIDs(
+ 'squidhtcppurge', 32, count( $urlArr ), UIDGenerator::QUICK_VOLATILE
+ );
+
foreach ( $urlArr as $url ) {
if ( !is_string( $url ) ) {
wfProfileOut( __METHOD__ );
$conf = self::getRuleForURL( $url, $wgHTCPRouting );
if ( !$conf ) {
wfDebugLog( 'squid', __METHOD__ .
- "No HTCP rule configured for URL {$url} , skipping\n" );
+ "No HTCP rule configured for URL {$url} , skipping" );
continue;
}
// Construct a minimal HTCP request diagram
// as per RFC 2756
// Opcode 'CLR', no response desired, no auth
- $htcpTransID = rand();
+ $htcpTransID = current( $ids );
+ next( $ids );
$htcpSpecifier = pack( 'na4na*na8n',
4, 'HEAD', strlen( $url ), $url,
$htcpTransID, $htcpSpecifier, 2 );
wfDebugLog( 'squid', __METHOD__ .
- "Purging URL $url via HTCP\n" );
+ "Purging URL $url via HTCP" );
foreach ( $conf as $subconf ) {
socket_sendto( $conn, $htcpPacket, $htcpLen, 0,
$subconf['host'], $subconf['port'] );