Skip to content

Commit

Permalink
vehicles: remove historic field from PoolPassiveIoFileMessage
Browse files Browse the repository at this point in the history
Motivation:
PoolPassiveIoFileMessage contains an array of InetSocketAddress to
tell doors where all possible endpoint for a client and a single
InetSocketAddress, that points only to the first element of the array.
This historic construction makes no sense any more as all dcache around
already handle the array based version.

Modification:
remove remove historic field from PoolPassiveIoFileMessage. Update dcap
door to use PoolPassiveIoFileMessage#socketAddresses.

Result:
less code.

This change is backward compatible, e.g. new doors will work with old
pools, but required new DCAP doors to work with new pools, which is OK.

Acked-by: Paul Millar
Target: master
Require-book: no
Require-notes: yes
  • Loading branch information
kofemann committed Feb 26, 2020
1 parent 59701ce commit 8bbae91
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 13 deletions.
Expand Up @@ -2226,7 +2226,7 @@ private void storeChecksumInPnfs( PnfsId pnfsId , String checksumString){

public void poolPassiveIoFileMessage( PoolPassiveIoFileMessage<byte[]> reply) {

InetSocketAddress poolSocketAddress = reply.socketAddress();
InetSocketAddress poolSocketAddress = reply.socketAddresses()[0];

StringBuilder sb = new StringBuilder() ;
sb.append(_sessionId).append(" ").
Expand Down
Expand Up @@ -3,10 +3,11 @@
import java.io.Serializable;
import java.net.InetSocketAddress;

import static java.util.Objects.requireNonNull;

public class PoolPassiveIoFileMessage<T extends Serializable> extends PoolMessage {

private static final long serialVersionUID = -8019787998659861618L;
private final InetSocketAddress _socketAddress;
private final InetSocketAddress[] _socketAddresses;
private final T _challange;

Expand All @@ -30,22 +31,13 @@ public PoolPassiveIoFileMessage(String pool, InetSocketAddress socketAddress, T
*/
public PoolPassiveIoFileMessage(String pool, InetSocketAddress[] socketAddresses, T challenge, long verifier) {
super(pool);
_socketAddresses = socketAddresses;
_socketAddress = _socketAddresses[0];
_socketAddresses = requireNonNull(socketAddresses, "Socket address is not defined.");
_challange = challenge;
_verifier = verifier;
}

public InetSocketAddress socketAddress() {
return _socketAddress;
}

public InetSocketAddress[] socketAddresses() {
/*
* A bit of crappy code to handle old/new version of the class.
*/
return _socketAddresses == null?
new InetSocketAddress[] { _socketAddress } : _socketAddresses;
return _socketAddresses;
}

public long getVerifier() {
Expand Down

0 comments on commit 8bbae91

Please sign in to comment.