* @return True if we handled the message (i.e. always).
*/
public boolean handleRequestRevocation(Message m, final PeerNode source) {
// Do we have the data?
final RandomAccessBuffer data = updateManager.revocationChecker.getBlobBuffer();
if(data == null) {
Logger.normal(this, "Peer " + source + " asked us for the blob file for the revocation key but we don't have it!");
// Probably a race condition on reconnect, hopefully we'll be asked again
return true;
}
final long uid = m.getLong(DMT.UID);
final PartiallyReceivedBulk prb;
long length;
length = data.size();
prb = new PartiallyReceivedBulk(updateManager.node.getUSM(), length,
Node.PACKET_SIZE, data, true);
final BulkTransmitter bt;
try {
bt = new BulkTransmitter(prb, source, uid, false, updateManager.ctr, true);
} catch(DisconnectedException e) {
Logger.error(this, "Peer " + source + " asked us for the blob file for the revocation key, then disconnected: " + e, e);
data.close();
return true;
}
final Runnable r = new Runnable() {
@Override
public void run() {
try {
if(!bt.send())
Logger.error(this, "Failed to send revocation key blob to " + source.userToString() + " : " + bt.getCancelReason());
else
Logger.normal(this, "Sent revocation key blob to " + source.userToString());
} catch (DisconnectedException e) {
// Not much we can do here either.
Logger.warning(this, "Failed to send revocation key blob (disconnected) to " + source.userToString() + " : " + bt.getCancelReason());
} finally {
data.close();
}
}
};
Message msg = DMT.createUOMSendingRevocation(uid, length, updateManager.getRevocationURI().toString());