From 1e7806855d043e03a5ddbc6a7b925b93b8fdd3eb Mon Sep 17 00:00:00 2001 From: John Jones Date: Wed, 9 Aug 2017 09:46:53 -0500 Subject: [PATCH] Using muiltistream protocol to begin secio negotiation --- secio/secio.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/secio/secio.c b/secio/secio.c index 2f3985e..bebcdfa 100644 --- a/secio/secio.c +++ b/secio/secio.c @@ -524,6 +524,7 @@ int libp2p_secio_unencrypted_write(struct SessionContext* session, unsigned char written += written_this_time; } while (left > 0); num_bytes = written; + */ } // there was something to send return num_bytes; @@ -882,15 +883,14 @@ int libp2p_secio_handshake(struct SessionContext* local_session, struct RsaPriva memcpy(&total[protocol_len], propose_out_bytes, propose_out_size); // write the Proposal to the stream - bytes_written = libp2p_secio_unencrypted_write(local_session, total, protocol_len + propose_out_size); - if (bytes_written < propose_out_size + protocol_len) + if (!local_session->default_stream->write(local_session, total, protocol_len + propose_out_size)) goto exit; if (incoming_size > 0) { propose_in_bytes = (uint8_t*)incoming; propose_in_size = incoming_size; } else { - bytes_written = libp2p_secio_unencrypted_read(local_session, &propose_in_bytes, &propose_in_size, 10); + bytes_written = local_session->default_stream->read(local_session, &propose_in_bytes, &propose_in_size, 10); if (bytes_written <= 0) goto exit; }