Passing SessionContext instead of Stream
This commit is contained in:
parent
3a68619016
commit
ac5a622400
6 changed files with 9 additions and 5 deletions
|
@ -658,6 +658,8 @@ int ipfs_bitswap_message_add_wantlist_items(struct BitswapMessage* message, stru
|
|||
for(int i = 0; i < cids->total; i++) {
|
||||
const struct Cid* cid = (const struct Cid*)libp2p_utils_vector_get(cids, i);
|
||||
struct WantlistEntry* entry = ipfs_bitswap_wantlist_entry_new();
|
||||
entry->block_size = ipfs_cid_protobuf_encode_size(cid);
|
||||
entry->block = (unsigned char*) malloc(entry->block_size);
|
||||
if (!ipfs_cid_protobuf_encode(cid, entry->block, entry->block_size, &entry->block_size)) {
|
||||
// TODO: we should do more than return a half-baked list
|
||||
return 0;
|
||||
|
|
|
@ -34,7 +34,7 @@ int ipfs_bitswap_network_send_message(const struct BitswapContext* context, stru
|
|||
memcpy(buf, "/ipfs/bitswap/1.1.0\n", 20);
|
||||
buf_size += 20;
|
||||
// send it
|
||||
int bytes_written = peer->sessionContext->default_stream->write(peer->sessionContext->default_stream, buf, buf_size);
|
||||
int bytes_written = peer->sessionContext->default_stream->write(peer->sessionContext, buf, buf_size);
|
||||
if (bytes_written <= 0) {
|
||||
free(buf);
|
||||
return 0;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue