secio unencrypted read fix
This commit is contained in:
parent
7c39799103
commit
198e5d544a
2 changed files with 9 additions and 2 deletions
|
@ -173,8 +173,10 @@ struct Libp2pPeer* libp2p_peer_copy(const struct Libp2pPeer* in) {
|
|||
struct Libp2pLinkedList* copy_item = libp2p_utils_linked_list_new();
|
||||
copy_item->item = multiaddress_copy(addr);
|
||||
if (out->addr_head == NULL) {
|
||||
// first one
|
||||
out->addr_head = copy_item;
|
||||
} else {
|
||||
// not the first, tack it on the end
|
||||
current_out->next = copy_item;
|
||||
}
|
||||
current_out = copy_item;
|
||||
|
|
|
@ -589,9 +589,14 @@ int libp2p_secio_unencrypted_read(struct SessionContext* session, unsigned char*
|
|||
libp2p_logger_debug("secio", "Attempted read, but got EAGAIN or EWOULDBLOCK. Code %d.\n", errno);
|
||||
return 0;
|
||||
} else {
|
||||
// is this really an error?
|
||||
if (errno != 0) {
|
||||
libp2p_logger_error("secio", "Error in libp2p_secio_unencrypted_read: %s\n", strerror(errno));
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
libp2p_logger_error("secio", "Error in libp2p_secio_unencrypted_read: 0 bytes read, but errno shows no error. Trying again.\n");
|
||||
}
|
||||
} else {
|
||||
left = left - read_this_time;
|
||||
read += read_this_time;
|
||||
|
|
Loading…
Reference in a new issue