correctly adding request to peer_request_queue
This commit is contained in:
parent
c58bfc9b1e
commit
5de67539ef
2 changed files with 8 additions and 4 deletions
|
@ -85,7 +85,7 @@ void* ipfs_bitswap_engine_peer_request_processor_start(void* ctx) {
|
|||
if (current_peer_entry->sessionContext == NULL || current_peer_entry->sessionContext->default_stream == NULL) {
|
||||
current_peer_entry->connection_type = CONNECTION_TYPE_NOT_CONNECTED;
|
||||
} else {
|
||||
libp2p_logger_debug("bitswap_engine", "We're connected to this peer. Lets see if there is a message waiting for us.\n");
|
||||
libp2p_logger_debug("bitswap_engine", "We're connected to %s. Lets see if there is a message waiting for us.\n", current_peer_entry->id);
|
||||
int retVal = current_peer_entry->sessionContext->default_stream->peek(current_peer_entry->sessionContext);
|
||||
if (retVal < 0) {
|
||||
libp2p_logger_debug("bitswap_engine", "We thought we were connected, but Peek reported an error.\n");
|
||||
|
|
|
@ -427,10 +427,14 @@ struct PeerRequest* ipfs_peer_request_queue_find_peer(struct PeerRequestQueue* q
|
|||
entry->current = ipfs_bitswap_peer_request_new();
|
||||
entry->current->peer = peer;
|
||||
// attach it to the queue
|
||||
if (queue->first == NULL)
|
||||
if (queue->first == NULL) {
|
||||
queue->first = entry;
|
||||
entry->prior = queue->last;
|
||||
queue->last = entry;
|
||||
queue->last = entry;
|
||||
} else {
|
||||
queue->last->next = entry;
|
||||
entry->prior = queue->last;
|
||||
queue->last = entry;
|
||||
}
|
||||
|
||||
return entry->current;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue