Skip to content

Commit cbf1dff

Browse files
authored
chore: prep for 0.91.0 release (#52)
1 parent 697fc8c commit cbf1dff

File tree

7 files changed

+43
-19
lines changed

7 files changed

+43
-19
lines changed

Cargo.toml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ required-features = ["headers"] # Do not build unless generating headers.
1919
[dependencies]
2020
anyhow = "1"
2121
bytes = "1.10"
22-
iroh = { version = "0.90", features = ["discovery-local-network"] }
23-
iroh-base = { version = "0.90", features = ["ticket"] }
22+
iroh = { version = "0.91", features = ["discovery-local-network"] }
23+
iroh-base = { version = "0.91", features = ["ticket"] }
2424
once_cell = "1.21"
2525
rand = "0.8"
2626
safer-ffi = { version = "0.1.13" }
@@ -37,7 +37,3 @@ data-encoding = "2.9.0"
3737
[features]
3838
# generate headers
3939
headers = ["safer-ffi/headers"]
40-
41-
[patch.crates-io]
42-
iroh = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }
43-
iroh-base = { git = "https://github.com/n0-computer/iroh.git", branch = "main" }

Makefile

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,26 @@
11
CC = cc
2-
CFLAGS = -Wall -g
2+
CFLAGS = -Wall -g -O0
33
LDFLAGS = -L ./target/debug -l iroh_c_ffi -lSystem -lc -lm
44

55
all: main multi-thread-client multi-thread-server single-thread-server
6+
67
main: main.o
7-
main.o: main.c
8+
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
89

910
multi-thread-client: multi-thread-client.o
10-
multi-thread-client.o: multi-thread-client.c
11-
single-thread-server: single-thread-server.o
12-
single-thread-server.o: single-thread-server.c
11+
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
12+
1313
multi-thread-server: multi-thread-server.o
14-
multi-thread-server.o: multi-thread-server.c
14+
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
15+
16+
single-thread-server: single-thread-server.o
17+
$(CC) $(CFLAGS) -o $@ $^ $(LDFLAGS)
18+
19+
# Generic compile rule for .c → .o
20+
%.o: %.c
21+
$(CC) $(CFLAGS) -c $< -o $@
1522

1623
clean:
17-
rm -f main main.o multi-thread-client.o multi-thread-client multi-thread-server.o multi-thread-server single-thread-server.o single-thread-server
24+
rm -f main main.o multi-thread-client.o multi-thread-client \
25+
multi-thread-server.o multi-thread-server \
26+
single-thread-server.o single-thread-server

deny.toml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,3 @@ name = "ring"
3838
[[licenses.clarify.license-files]]
3939
hash = 3171872035
4040
path = "LICENSE"
41-
42-
[sources]
43-
allow-git = ["https://github.com/n0-computer/iroh.git"]

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: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,15 @@ callback(
276276
ConnectionType_t conn_type
277277
)
278278
{
279+
printf("Callback 0\n");
279280
ConnectionStatus *cs;
281+
printf("Callback 1\n");
280282
cs = (ConnectionStatus *)ctx;
283+
printf("Callback 2\n");
281284
cs->res = res;
285+
printf("Callback 3\n");
282286
cs->conn_type = conn_type;
287+
printf("Callback done\n");
283288
}
284289

285290
int
@@ -461,17 +466,23 @@ run_client (
461466

462467
// 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.
463468

469+
printf("free recv_stream\n");
470+
recv_stream_free(recv_stream);
471+
464472
printf("closing endpoint\n");
465473
endpoint_close(ep);
466474
printf("endpoint closed\n");
467475

476+
printf("fflush to stdout\n");
468477
fflush(stdout);
469478

470479
// cleanup
480+
printf("free recv_str\n");
471481
free(recv_str);
482+
printf("free recv_buffer\n");
472483
free(recv_buffer);
484+
printf("free conn_status\n");
473485
free(conn_status);
474-
recv_stream_free(recv_stream);
475486
return 0;
476487
}
477488

@@ -523,6 +534,7 @@ main (int argc, char const * const argv[])
523534
return ret;
524535
}
525536

537+
printf("free addrs\n");
526538
// cleanup
527539
free(addrs);
528540

@@ -541,7 +553,9 @@ main (int argc, char const * const argv[])
541553
}
542554

543555
// cleanup
556+
printf("free config\n");
544557
endpoint_config_free(config);
545558

559+
printf("exit\n");
546560
return EXIT_SUCCESS;
547561
}

src/endpoint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -987,7 +987,7 @@ pub fn endpoint_node_addr(ep: &repr_c::Box<Endpoint>, out: &mut NodeAddr) -> End
987987
.expect("endpoint not initialized")
988988
.node_addr()
989989
.initialized()
990-
.await?;
990+
.await;
991991
anyhow::Ok(addr)
992992
});
993993

@@ -1015,7 +1015,7 @@ pub fn endpoint_home_relay(ep: &repr_c::Box<Endpoint>, out: &mut Url) -> Endpoin
10151015
.expect("endpoint not initialized")
10161016
.home_relay()
10171017
.initialized()
1018-
.await?;
1018+
.await;
10191019
anyhow::Ok(relay_url)
10201020
});
10211021

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)