Skip to content

Commit 0165639

Browse files
Two additions to the operations struct and minor fix to the timer function added last commit
1 parent 0c0cb85 commit 0165639

File tree

2 files changed

+38
-30
lines changed

2 files changed

+38
-30
lines changed

neat.h

+2
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ typedef void (*neat_cb_send_failure_t)(struct neat_flow_operations *, int, const
6666

6767
struct neat_flow_operations {
6868
// Used by the Python shim
69+
uint32_t preconnection_id;
70+
uint32_t rendezvous_id;
6971
uint32_t connection_id;
7072
uint32_t parent_id;
7173
uint32_t clone_id;

neat_core.c

+36-30
Original file line numberDiff line numberDiff line change
@@ -1811,24 +1811,26 @@ nt_log(ctx, NEAT_LOG_INFO, "Prot: %d", prot);
18111811
nt_log(ctx, NEAT_LOG_WARNING, "Out of memory");
18121812
return READ_WITH_ERROR;
18131813
}
1814-
multistream_flow->port = listen_flow->port;
1815-
multistream_flow->everConnected = 1;
1816-
multistream_flow->socket = socket;
1817-
multistream_flow->ctx = ctx;
1818-
multistream_flow->isServer = 1;
1819-
multistream_flow->operations.on_connected = listen_flow->operations.on_connected;
1820-
multistream_flow->operations.on_readable = listen_flow->operations.on_readable;
1821-
multistream_flow->operations.on_writable = listen_flow->operations.on_writable;
1822-
multistream_flow->operations.on_close = listen_flow->operations.on_close;
1823-
multistream_flow->operations.on_error = listen_flow->operations.on_error;
1824-
multistream_flow->operations.ctx = ctx;
1825-
multistream_flow->operations.flow = multistream_flow;
1826-
multistream_flow->operations.userData = listen_flow->operations.userData;
1827-
multistream_flow->operations.connection_id = listen_flow->operations.connection_id;
1828-
multistream_flow->operations.parent_id = listen_flow->operations.parent_id;
1829-
multistream_flow->operations.clone_id = listen_flow->operations.clone_id;
1830-
multistream_flow->multistream_id = stream_id;
1831-
multistream_flow->state = NEAT_FLOW_OPEN;
1814+
multistream_flow->port = listen_flow->port;
1815+
multistream_flow->everConnected = 1;
1816+
multistream_flow->socket = socket;
1817+
multistream_flow->ctx = ctx;
1818+
multistream_flow->isServer = 1;
1819+
multistream_flow->operations.on_connected = listen_flow->operations.on_connected;
1820+
multistream_flow->operations.on_readable = listen_flow->operations.on_readable;
1821+
multistream_flow->operations.on_writable = listen_flow->operations.on_writable;
1822+
multistream_flow->operations.on_close = listen_flow->operations.on_close;
1823+
multistream_flow->operations.on_error = listen_flow->operations.on_error;
1824+
multistream_flow->operations.ctx = ctx;
1825+
multistream_flow->operations.flow = multistream_flow;
1826+
multistream_flow->operations.userData = listen_flow->operations.userData;
1827+
multistream_flow->operations.preconnection_id = listen_flow->operations.preconnection_id;
1828+
multistream_flow->operations.rendezvous_id = listen_flow->operations.rendezvous_id;
1829+
multistream_flow->operations.connection_id = listen_flow->operations.connection_id;
1830+
multistream_flow->operations.parent_id = listen_flow->operations.parent_id;
1831+
multistream_flow->operations.clone_id = listen_flow->operations.clone_id;
1832+
multistream_flow->multistream_id = stream_id;
1833+
multistream_flow->state = NEAT_FLOW_OPEN;
18321834

18331835
LIST_INSERT_HEAD(&flow->socket->sctp_multistream_flows, multistream_flow, multistream_next_flow);
18341836

@@ -2197,7 +2199,9 @@ he_connected_cb(uv_poll_t *handle, int status, int events)
21972199
c++;
21982200
nt_log(ctx, NEAT_LOG_DEBUG, "Invocation count: %d - flow: %p", c, flow);
21992201

2200-
uv_timer_stop(flow->initiate_timer);
2202+
if (flow->initiate_timer != NULL){
2203+
uv_timer_stop(flow->initiate_timer);
2204+
}
22012205
nt_log(ctx, NEAT_LOG_INFO, "Initiate timer stopped");
22022206

22032207

@@ -2746,17 +2750,19 @@ do_accept(neat_ctx *ctx, neat_flow *flow, struct neat_pollable_socket *listen_so
27462750
newFlow->security_needed = flow->security_needed;
27472751
newFlow->eofSeen = 0;
27482752

2749-
newFlow->operations.on_connected = flow->operations.on_connected;
2750-
newFlow->operations.on_readable = flow->operations.on_readable;
2751-
newFlow->operations.on_writable = flow->operations.on_writable;
2752-
newFlow->operations.on_close = flow->operations.on_close;
2753-
newFlow->operations.on_error = flow->operations.on_error;
2754-
newFlow->operations.ctx = ctx;
2755-
newFlow->operations.flow = flow;
2756-
newFlow->operations.userData = flow->operations.userData;
2757-
newFlow->operations.connection_id = flow->operations.connection_id;
2758-
newFlow->operations.parent_id = flow->operations.parent_id;
2759-
newFlow->operations.clone_id = flow->operations.clone_id;
2753+
newFlow->operations.on_connected = flow->operations.on_connected;
2754+
newFlow->operations.on_readable = flow->operations.on_readable;
2755+
newFlow->operations.on_writable = flow->operations.on_writable;
2756+
newFlow->operations.on_close = flow->operations.on_close;
2757+
newFlow->operations.on_error = flow->operations.on_error;
2758+
newFlow->operations.ctx = ctx;
2759+
newFlow->operations.flow = flow;
2760+
newFlow->operations.userData = flow->operations.userData;
2761+
newFlow->operations.preconnection_id = flow->operations.preconnection_id;
2762+
newFlow->operations.rendezvous_id = flow->operations.rendezvous_id;
2763+
newFlow->operations.connection_id = flow->operations.connection_id;
2764+
newFlow->operations.parent_id = flow->operations.parent_id;
2765+
newFlow->operations.clone_id = flow->operations.clone_id;
27602766

27612767
#ifdef NEAT_SCTP_DTLS
27622768
if (flow->security_needed && newFlow->socket->stack == NEAT_STACK_SCTP) {

0 commit comments

Comments
 (0)