/** Offer a key to this node */ public void offer(Key key) { byte[] keyBytes = key.getFullKey(); // FIXME maybe the authenticator should be shorter than 32 bytes to save memory? byte[] authenticator = HMAC.macWithSHA256(node.failureTable.offerAuthenticatorKey, keyBytes); Message msg = DMT.createFNPOfferKey(key, authenticator); try { sendAsync(msg, null, node.nodeStats.sendOffersCtr); } catch(NotConnectedException e) { // Ignore } }
store.put(block.getBlock(), false); assertEquals(saltStore.fetch(block.getKey().getRoutingKey(), block.getKey().getFullKey(), false, false, false, false, null), null); tests.add(test); chkBlocks.add(block); assertEquals(test, data); assertNotNull(saltStore.fetch(block.getKey().getRoutingKey(), block.getKey().getFullKey(), false, false, false, false, null));
ClientCHKBlock block = encodeBlockCHK(test); assertEquals(saltStore.fetch(block.getKey().getRoutingKey(), block.getKey().getFullKey(), false, false, false, false, null), null); store.put(block.getBlock(), false); tests.add(test);
assertEquals(test, data); assertNotNull(saltStore.fetch(block.getKey().getRoutingKey(), block.getKey().getFullKey(), false, false, false, false, null));
assertEquals(test, data); assertNotNull(saltStore2.fetch(block.getKey().getRoutingKey(), block.getKey().getFullKey(), false, false, false, false, null));
byte[] authenticator = ((ShortBuffer) m.getObject(DMT.OFFER_AUTHENTICATOR)).getData(); long uid = m.getLong(DMT.UID); if(!HMAC.verifyWithSHA256(node.failureTable.offerAuthenticatorKey, key.getFullKey(), authenticator)) { Logger.error(this, "Invalid offer request from "+source+" : authenticator did not verify"); try {
assertNull(saltStore.fetch(block.getKey().getRoutingKey(), block.getKey().getFullKey(), false, false, false, false, null)); } else { assertNotNull(saltStore.fetch(block.getKey().getRoutingKey(), block.getKey().getFullKey(), false, false, false, false, null));