Wait for the message to be actually sent before continuing

This commit is contained in:
Yu Pan 2018-08-09 16:15:54 -07:00
parent 11d7c32d1a
commit 003c658927

View File

@ -36,7 +36,7 @@ const exchangeHeads = async (ipfs, address, peer, getStore, getDirectConnection,
const heads = getHeadsForDatabase(getStore(address))
logger.debug(`Send latest heads of '${address}':\n`, JSON.stringify(heads.map(e => e.hash), null, 2))
if (heads) {
channel.send(JSON.stringify({ address: address, heads: heads }))
await channel.send(JSON.stringify({ address: address, heads: heads }))
}
return channel