Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

variable renaming #165

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
3693244
copied perf test from sendmmsg branch
jthomas43 Apr 19, 2023
7c6c578
trailing whitespace
jthomas43 Apr 21, 2023
5c07467
Merge branch 'master' of github.com:jthomas43/libudx
jthomas43 May 26, 2023
2df62eb
Merge branch 'holepunchto:main' into main
jthomas43 May 30, 2023
400de49
Merge branch 'holepunchto:main' into main
jthomas43 Aug 11, 2023
944cd60
Merge branch 'holepunchto:main' into main
jthomas43 Sep 12, 2023
10f535b
Merge branch 'holepunchto:main' into main
jthomas43 Sep 15, 2023
17a53fa
Merge branch 'holepunchto:main' into main
jthomas43 Sep 22, 2023
adcec59
Merge branch 'holepunchto:main' into main
jthomas43 Sep 26, 2023
df3e9a3
fix some warnings, add warnings to build
jthomas43 Sep 27, 2023
7e32418
Merge branch 'holepunchto:main' into main
jthomas43 Sep 27, 2023
4920342
Merge branch 'main' into feature/fix-warnings
jthomas43 Sep 27, 2023
4b9b267
cleanup warnings
jthomas43 Sep 28, 2023
a99f1c0
Merge branch 'holepunchto:main' into main
jthomas43 Oct 3, 2023
c21d187
Merge branch 'main' of github.com:jthomas43/libudx
jthomas43 Oct 3, 2023
ff35d82
Merge branch 'holepunchto:main' into main
jthomas43 Oct 4, 2023
7dd871c
Merge branch 'main' of github.com:jthomas43/libudx
jthomas43 Oct 4, 2023
912efdb
Merge branch 'holepunchto:main' into main
jthomas43 Oct 6, 2023
b5c6fdb
Merge branch 'main' of github.com:jthomas43/libudx
jthomas43 Oct 6, 2023
3e2b47c
Merge branch 'main' of github.com:jthomas43/libudx
jthomas43 Oct 11, 2023
eb44eaa
Merge branch 'main' of github.com:jthomas43/libudx
jthomas43 Oct 13, 2023
a494959
Merge branch 'main' of github.com:jthomas43/libudx
jthomas43 Oct 26, 2023
9320fe3
rename udx_stream / udx_socket variables to 'stream' and 'socket' ins…
jthomas43 Nov 1, 2023
22fbe33
fix windows compile
jthomas43 Nov 2, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 49 additions & 49 deletions include/udx.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ typedef struct udx_lookup_s udx_lookup_t;
typedef struct udx_interface_event_s udx_interface_event_t;

typedef void (*udx_socket_send_cb)(udx_socket_send_t *req, int status);
typedef void (*udx_socket_recv_cb)(udx_socket_t *handle, ssize_t read_len, const uv_buf_t *buf, const struct sockaddr *from);
typedef void (*udx_socket_close_cb)(udx_socket_t *handle);
typedef void (*udx_socket_recv_cb)(udx_socket_t *socket, ssize_t read_len, const uv_buf_t *buf, const struct sockaddr *from);
typedef void (*udx_socket_close_cb)(udx_socket_t *socket);

typedef int (*udx_stream_firewall_cb)(udx_stream_t *handle, udx_socket_t *socket, const struct sockaddr *from);
typedef void (*udx_stream_read_cb)(udx_stream_t *handle, ssize_t read_len, const uv_buf_t *buf);
typedef void (*udx_stream_drain_cb)(udx_stream_t *handle);
typedef void (*udx_stream_remote_changed_cb)(udx_stream_t *handle);
typedef int (*udx_stream_firewall_cb)(udx_stream_t *stream, udx_socket_t *socket, const struct sockaddr *from);
typedef void (*udx_stream_read_cb)(udx_stream_t *stream, ssize_t read_len, const uv_buf_t *buf);
typedef void (*udx_stream_drain_cb)(udx_stream_t *stream);
typedef void (*udx_stream_remote_changed_cb)(udx_stream_t *stream);
typedef void (*udx_stream_ack_cb)(udx_stream_write_t *req, int status, int unordered);
typedef void (*udx_stream_send_cb)(udx_stream_send_t *req, int status);
typedef void (*udx_stream_recv_cb)(udx_stream_t *handle, ssize_t read_len, const uv_buf_t *buf);
typedef void (*udx_stream_close_cb)(udx_stream_t *handle, int status);
typedef void (*udx_stream_recv_cb)(udx_stream_t *stream, ssize_t read_len, const uv_buf_t *buf);
typedef void (*udx_stream_close_cb)(udx_stream_t *stream, int status);

typedef void (*udx_lookup_cb)(udx_lookup_t *handle, int status, const struct sockaddr *addr, int addr_len);

Expand All @@ -135,7 +135,7 @@ struct udx_s {
};

struct udx_socket_s {
uv_udp_t socket;
uv_udp_t handle;
uv_poll_t io_poll;
udx_fifo_t send_queue;

Expand Down Expand Up @@ -175,7 +175,7 @@ struct udx_stream_s {
int set_id;
int status;
int out_of_order;
int recovery;
int recovery; // number of packets to send before recovery finished
int deferred_ack;

bool hit_high_watermark;
Expand Down Expand Up @@ -235,7 +235,7 @@ struct udx_stream_s {
uint32_t pkts_inflight; // packets inflight to the other peer
uint32_t pkts_buffered; // how many (data) packets received but not processed (out of order)?
uint32_t retransmits_waiting; // how many retransmits are waiting to be sent? if 0, then inflight iteration is faster
uint32_t seq_flushed; // highest seq that has been flushed
uint32_t seq_flushed; // highest seq that has been flushed. usually seq_flushed == seq

// timestamps...
uint64_t rto_timeout;
Expand Down Expand Up @@ -287,7 +287,7 @@ struct udx_packet_s {

struct udx_socket_send_s {
udx_packet_t pkt;
udx_socket_t *handle;
udx_socket_t *socket;

udx_socket_send_cb on_send;

Expand All @@ -299,15 +299,15 @@ struct udx_stream_write_s {
uv_buf_t buf;
bool is_write_end;

udx_stream_t *handle;
udx_stream_t *stream;
udx_stream_ack_cb on_ack;

void *data;
};

struct udx_stream_send_s {
udx_packet_t pkt;
udx_stream_t *handle;
udx_stream_t *stream;

udx_stream_send_cb on_send;

Expand Down Expand Up @@ -338,114 +338,114 @@ struct udx_interface_event_s {
};

int
udx_init (uv_loop_t *loop, udx_t *handle);
udx_init (uv_loop_t *loop, udx_t *udx);

int
udx_socket_init (udx_t *handle, udx_socket_t *socket);
udx_socket_init (udx_t *udx, udx_socket_t *socket);

int
udx_socket_get_send_buffer_size (udx_socket_t *handle, int *value);
udx_socket_get_send_buffer_size (udx_socket_t *socket, int *value);

int
udx_socket_set_send_buffer_size (udx_socket_t *handle, int value);
udx_socket_set_send_buffer_size (udx_socket_t *socket, int value);

int
udx_socket_get_recv_buffer_size (udx_socket_t *handle, int *value);
udx_socket_get_recv_buffer_size (udx_socket_t *socket, int *value);

int
udx_socket_set_recv_buffer_size (udx_socket_t *handle, int value);
udx_socket_set_recv_buffer_size (udx_socket_t *socket, int value);

int
udx_socket_get_ttl (udx_socket_t *handle, int *ttl);
udx_socket_get_ttl (udx_socket_t *socket, int *ttl);

int
udx_socket_set_ttl (udx_socket_t *handle, int ttl);
udx_socket_set_ttl (udx_socket_t *socket, int ttl);

int
udx_socket_bind (udx_socket_t *handle, const struct sockaddr *addr, unsigned int flags);
udx_socket_bind (udx_socket_t *socket, const struct sockaddr *addr, unsigned int flags);

int
udx_socket_getsockname (udx_socket_t *handle, struct sockaddr *name, int *name_len);
udx_socket_getsockname (udx_socket_t *socket, struct sockaddr *name, int *name_len);

int
udx_socket_send (udx_socket_send_t *req, udx_socket_t *handle, const uv_buf_t bufs[], unsigned int bufs_len, const struct sockaddr *addr, udx_socket_send_cb cb);
udx_socket_send (udx_socket_send_t *req, udx_socket_t *socket, const uv_buf_t bufs[], unsigned int bufs_len, const struct sockaddr *addr, udx_socket_send_cb cb);

int
udx_socket_send_ttl (udx_socket_send_t *req, udx_socket_t *handle, const uv_buf_t bufs[], unsigned int bufs_len, const struct sockaddr *addr, int ttl, udx_socket_send_cb cb);
udx_socket_send_ttl (udx_socket_send_t *req, udx_socket_t *socket, const uv_buf_t bufs[], unsigned int bufs_len, const struct sockaddr *addr, int ttl, udx_socket_send_cb cb);

int
udx_socket_recv_start (udx_socket_t *handle, udx_socket_recv_cb cb);
udx_socket_recv_start (udx_socket_t *socket, udx_socket_recv_cb cb);

int
udx_socket_recv_stop (udx_socket_t *handle);
udx_socket_recv_stop (udx_socket_t *socket);

int
udx_socket_close (udx_socket_t *handle, udx_socket_close_cb cb);
udx_socket_close (udx_socket_t *socket, udx_socket_close_cb cb);

// only exposed here as a convenience / debug tool - the udx instance uses this automatically
int
udx_check_timeouts (udx_t *handle);
udx_check_timeouts (udx_t *udx);

int
udx_stream_init (udx_t *udx, udx_stream_t *handle, uint32_t local_id, udx_stream_close_cb close_cb);
udx_stream_init (udx_t *udx, udx_stream_t *stream, uint32_t local_id, udx_stream_close_cb close_cb);

int
udx_stream_get_mtu (udx_stream_t *handle, uint16_t *mtu);
udx_stream_get_mtu (udx_stream_t *stream, uint16_t *mtu);

int
udx_stream_get_seq (udx_stream_t *handle, uint32_t *seq);
udx_stream_get_seq (udx_stream_t *stream, uint32_t *seq);

int
udx_stream_set_seq (udx_stream_t *handle, uint32_t seq);
udx_stream_set_seq (udx_stream_t *stream, uint32_t seq);

int
udx_stream_get_ack (udx_stream_t *handle, uint32_t *ack);
udx_stream_get_ack (udx_stream_t *stream, uint32_t *ack);

int
udx_stream_set_ack (udx_stream_t *handle, uint32_t ack);
udx_stream_set_ack (udx_stream_t *stream, uint32_t ack);

int
udx_stream_connect (udx_stream_t *handle, udx_socket_t *socket, uint32_t remote_id, const struct sockaddr *remote_addr);
udx_stream_connect (udx_stream_t *stream, udx_socket_t *socket, uint32_t remote_id, const struct sockaddr *remote_addr);

int
udx_stream_change_remote (udx_stream_t *stream, udx_socket_t *socket, uint32_t remote_id, const struct sockaddr *remote_addr, udx_stream_remote_changed_cb remote_changed_cb);

int
udx_stream_relay_to (udx_stream_t *handle, udx_stream_t *destination);
udx_stream_relay_to (udx_stream_t *stream, udx_stream_t *destination);

int
udx_stream_firewall (udx_stream_t *handle, udx_stream_firewall_cb firewall_cb);
udx_stream_firewall (udx_stream_t *stream, udx_stream_firewall_cb firewall_cb);

int
udx_stream_recv_start (udx_stream_t *handle, udx_stream_recv_cb cb);
udx_stream_recv_start (udx_stream_t *stream, udx_stream_recv_cb cb);

int
udx_stream_recv_stop (udx_stream_t *handle);
udx_stream_recv_stop (udx_stream_t *stream);

int
udx_stream_read_start (udx_stream_t *handle, udx_stream_read_cb cb);
udx_stream_read_start (udx_stream_t *stream, udx_stream_read_cb cb);

int
udx_stream_read_stop (udx_stream_t *handle);
udx_stream_read_stop (udx_stream_t *stream);

// only exposed here as a convenience / debug tool - the udx instance uses this automatically
int
udx_stream_check_timeouts (udx_stream_t *handle);
udx_stream_check_timeouts (udx_stream_t *stream);

int
udx_stream_send (udx_stream_send_t *req, udx_stream_t *handle, const uv_buf_t bufs[], unsigned int bufs_len, udx_stream_send_cb cb);
udx_stream_send (udx_stream_send_t *req, udx_stream_t *stream, const uv_buf_t bufs[], unsigned int bufs_len, udx_stream_send_cb cb);

int
udx_stream_write_resume (udx_stream_t *handle, udx_stream_drain_cb drain_cb);
udx_stream_write_resume (udx_stream_t *stream, udx_stream_drain_cb drain_cb);

int
udx_stream_write (udx_stream_write_t *req, udx_stream_t *handle, const uv_buf_t bufs[], unsigned int bufs_len, udx_stream_ack_cb ack_cb);
udx_stream_write (udx_stream_write_t *req, udx_stream_t *stream, const uv_buf_t bufs[], unsigned int bufs_len, udx_stream_ack_cb ack_cb);

int
udx_stream_write_end (udx_stream_write_t *req, udx_stream_t *handle, const uv_buf_t bufs[], unsigned int bufs_len, udx_stream_ack_cb ack_cb);
udx_stream_write_end (udx_stream_write_t *req, udx_stream_t *stream, const uv_buf_t bufs[], unsigned int bufs_len, udx_stream_ack_cb ack_cb);

int
udx_stream_destroy (udx_stream_t *handle);
udx_stream_destroy (udx_stream_t *stream);

int
udx_lookup (uv_loop_t *loop, udx_lookup_t *req, const char *host, unsigned int flags, udx_lookup_cb cb);
Expand Down
11 changes: 3 additions & 8 deletions src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,27 +33,22 @@ debug_print_cwnd_stats (udx_stream_t *stream) {
static void
debug_print_outgoing (udx_stream_t *stream) {
if (DEBUG) {
uint32_t i = stream->seq_flushed - stream->remote_acked;
uint32_t j = stream->seq - stream->seq_flushed;

debug_printf("%-*s%-*s%s\n", i, "RA", j, "SF", "Seq");

for (uint32_t s = stream->remote_acked; s < stream->seq; s++) {
udx_packet_t *pkt = (udx_packet_t *) udx__cirbuf_get(&stream->outgoing, s);
if (pkt == NULL) {
debug_printf("-");
continue;
}

if (pkt->type == UDX_PACKET_INFLIGHT) {
if (pkt->status == UDX_PACKET_INFLIGHT) {
debug_printf("I");
continue;
}
if (pkt->type == UDX_PACKET_SENDING) {
if (pkt->status == UDX_PACKET_SENDING) {
debug_printf("S");
continue;
}
if (pkt->type == UDX_PACKET_WAITING) {
if (pkt->status == UDX_PACKET_WAITING) {
debug_printf("W");
continue;
}
Expand Down
8 changes: 4 additions & 4 deletions src/io_win.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ udx__get_link_mtu (const struct sockaddr *addr) {
}

ssize_t
udx__sendmsg (udx_socket_t *handle, const uv_buf_t bufs[], unsigned int bufs_len, struct sockaddr *addr, int addr_len) {
udx__sendmsg (udx_socket_t *socket, const uv_buf_t bufs[], unsigned int bufs_len, struct sockaddr *addr, int addr_len) {
DWORD bytes, flags = 0;

int result = WSASendTo(
handle->socket.socket,
socket->handle.socket,
(WSABUF *) bufs,
bufs_len,
&bytes,
Expand All @@ -61,11 +61,11 @@ udx__sendmsg (udx_socket_t *handle, const uv_buf_t bufs[], unsigned int bufs_len
}

ssize_t
udx__recvmsg (udx_socket_t *handle, uv_buf_t *buf, struct sockaddr *addr, int addr_len) {
udx__recvmsg (udx_socket_t *socket, uv_buf_t *buf, struct sockaddr *addr, int addr_len) {
DWORD bytes, flags = 0;

int result = WSARecvFrom(
handle->socket.socket,
socket->handle.socket,
(WSABUF *) buf,
1,
&bytes,
Expand Down
Loading
Loading