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();
|
struct Libp2pLinkedList* copy_item = libp2p_utils_linked_list_new();
|
||||||
copy_item->item = multiaddress_copy(addr);
|
copy_item->item = multiaddress_copy(addr);
|
||||||
if (out->addr_head == NULL) {
|
if (out->addr_head == NULL) {
|
||||||
|
// first one
|
||||||
out->addr_head = copy_item;
|
out->addr_head = copy_item;
|
||||||
} else {
|
} else {
|
||||||
|
// not the first, tack it on the end
|
||||||
current_out->next = copy_item;
|
current_out->next = copy_item;
|
||||||
}
|
}
|
||||||
current_out = copy_item;
|
current_out = copy_item;
|
||||||
|
|
|
@ -589,8 +589,13 @@ 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);
|
libp2p_logger_debug("secio", "Attempted read, but got EAGAIN or EWOULDBLOCK. Code %d.\n", errno);
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
libp2p_logger_error("secio", "Error in libp2p_secio_unencrypted_read: %s\n", strerror(errno));
|
// is this really an error?
|
||||||
return 0;
|
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 {
|
} else {
|
||||||
left = left - read_this_time;
|
left = left - read_this_time;
|
||||||
|
|
Loading…
Reference in a new issue