forked from Qortal/qortal
Use correct timeout (12s) when sending arbitrary data to a peer, and improved logging.
This commit is contained in:
parent
f78101e9cc
commit
c62c59b445
@ -288,7 +288,7 @@ public class ArbitraryDataFileManager extends Thread {
|
|||||||
// The ID needs to match that of the original request
|
// The ID needs to match that of the original request
|
||||||
message.setId(originalMessage.getId());
|
message.setId(originalMessage.getId());
|
||||||
|
|
||||||
if (!requestingPeer.sendMessage(message)) {
|
if (!requestingPeer.sendMessageWithTimeout(message, (int) ArbitraryDataManager.ARBITRARY_REQUEST_TIMEOUT)) {
|
||||||
LOGGER.debug("Failed to forward arbitrary data file to peer {}", requestingPeer);
|
LOGGER.debug("Failed to forward arbitrary data file to peer {}", requestingPeer);
|
||||||
requestingPeer.disconnect("failed to forward arbitrary data file");
|
requestingPeer.disconnect("failed to forward arbitrary data file");
|
||||||
}
|
}
|
||||||
@ -564,14 +564,17 @@ public class ArbitraryDataFileManager extends Thread {
|
|||||||
LOGGER.trace("Hash {} exists", hash58);
|
LOGGER.trace("Hash {} exists", hash58);
|
||||||
|
|
||||||
// We can serve the file directly as we already have it
|
// We can serve the file directly as we already have it
|
||||||
|
LOGGER.debug("Sending file {}...", arbitraryDataFile);
|
||||||
ArbitraryDataFileMessage arbitraryDataFileMessage = new ArbitraryDataFileMessage(signature, arbitraryDataFile);
|
ArbitraryDataFileMessage arbitraryDataFileMessage = new ArbitraryDataFileMessage(signature, arbitraryDataFile);
|
||||||
arbitraryDataFileMessage.setId(message.getId());
|
arbitraryDataFileMessage.setId(message.getId());
|
||||||
if (!peer.sendMessage(arbitraryDataFileMessage)) {
|
if (!peer.sendMessageWithTimeout(arbitraryDataFileMessage, (int) ArbitraryDataManager.ARBITRARY_REQUEST_TIMEOUT)) {
|
||||||
LOGGER.debug("Couldn't sent file");
|
LOGGER.debug("Couldn't send file {}", arbitraryDataFile);
|
||||||
peer.disconnect("failed to send file");
|
peer.disconnect("failed to send file");
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
LOGGER.debug("Sent file {}", arbitraryDataFile);
|
LOGGER.debug("Sent file {}", arbitraryDataFile);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (relayInfo != null) {
|
else if (relayInfo != null) {
|
||||||
LOGGER.debug("We have relay info for hash {}", Base58.encode(hash));
|
LOGGER.debug("We have relay info for hash {}", Base58.encode(hash));
|
||||||
// We need to ask this peer for the file
|
// We need to ask this peer for the file
|
||||||
|
Loading…
Reference in New Issue
Block a user