final HTTPNetworkConnection old_http_connection,
final byte[] old_hash,
final byte[] new_hash,
final String header )
{
final NetworkConnection old_connection = old_http_connection.getConnection();
PeerManagerRegistration reg_data =
PeerManager.getSingleton().manualMatchHash(
old_connection.getEndpoint().getNotionalAddress(),
new_hash );
if ( reg_data == null ){
old_http_connection.close( "Re-routing failed - registration not found" );
return;
}
final Transport transport = old_connection.detachTransport();
old_http_connection.close( "Switching torrents" );
final NetworkConnection new_connection =
NetworkManager.getSingleton().bindTransport(
transport,
new HTTPMessageEncoder(),
new HTTPMessageDecoder( header ));