Skip to content

Commit c603460

Browse files
author
“ramfox”
committed
add docs indicating you must call recv_stream_free and send_stream_free before endpoint_free
1 parent 2586d5f commit c603460

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

irohnet.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,8 @@ recv_stream_default (void);
838838
* Free the recv stream.
839839
*
840840
* Implicitly calls `stop(0)` on the connection.
841+
*
842+
* Must be called before `endpoint_free`
841843
*/
842844
void
843845
recv_stream_free (
@@ -1016,6 +1018,8 @@ send_stream_finish (
10161018

10171019
/** \brief
10181020
* Frees the send stream.
1021+
*
1022+
* Must be called before `endpoint_free`
10191023
*/
10201024
void
10211025
send_stream_free (

main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -457,9 +457,6 @@ run_client (
457457
return -1;
458458
}
459459

460-
printf("free recv_stream\n");
461-
recv_stream_free(recv_stream);
462-
463460
// indicate to the server that you want to close the connection
464461
printf("closing connection\n");
465462
connection_close(conn);
@@ -469,6 +466,9 @@ run_client (
469466

470467
// gracefully close the endpoint. This will wait until all the connections have closed gracefully, ensure the server receives a `CONNECTION_CLOSE`, so it can also cleanly close.
471468

469+
printf("free recv_stream\n");
470+
recv_stream_free(recv_stream);
471+
472472
printf("closing endpoint\n");
473473
endpoint_close(ep);
474474
printf("endpoint closed\n");

src/stream.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ pub fn recv_stream_default() -> repr_c::Box<RecvStream> {
2222
/// Free the recv stream.
2323
///
2424
/// Implicitly calls `stop(0)` on the connection.
25+
///
26+
/// Must be called before `endpoint_free`
2527
#[ffi_export]
2628
pub fn recv_stream_free(stream: repr_c::Box<RecvStream>) {
2729
drop(stream);
@@ -161,6 +163,8 @@ pub fn send_stream_default() -> repr_c::Box<SendStream> {
161163
}
162164

163165
/// Frees the send stream.
166+
///
167+
/// Must be called before `endpoint_free`
164168
#[ffi_export]
165169
pub fn send_stream_free(stream: repr_c::Box<SendStream>) {
166170
drop(stream);

0 commit comments

Comments
 (0)