/** Returns this Response as a RemoteFileDesc. */ public RemoteFileDesc toRemoteFileDesc(HostData data) { if (cachedRFD != null && cachedRFD.getPort() == data.getPort() && cachedRFD.getHost().equals(data.getIP())) return cachedRFD; else { RemoteFileDesc rfd = new RemoteFileDesc( data.getIP(), data.getPort(), getIndex(), getName(), (int) getSize(), data.getClientGUID(), data.getSpeed(), data.isChatEnabled(), data.getQuality(), data.isBrowseHostEnabled(), getDocument(), getUrns(), data.isReplyToMulticastQuery(), data.isFirewalled(), data.getVendorCode(), System.currentTimeMillis(), data.getPushProxies(), getCreateTime(), data.getFWTVersionSupported()); cachedRFD = rfd; return rfd; } }
/** * Constructs a new RemoteFileDesc exactly like the other one, but with a different push proxy * host. Will be handy when processing head pongs. */ public RemoteFileDesc(RemoteFileDesc rfd, PushEndpoint pe) { this( rfd.getHost(), // host - ignored rfd.getPort(), // port -ignored COPY_INDEX, // index (unknown) rfd.getFileName(), // filename rfd.getSize(), // filesize rfd.getSpeed(), // speed false, // chat capable rfd.getQuality(), // quality false, // browse hostable rfd.getUrns(), // urns false, // reply to MCast true, // is firewalled AlternateLocation.ALT_VENDOR, // vendor System.currentTimeMillis(), // timestamp rfd.getCreationTime(), // creation time pe); }