-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_linked_list.picoquic.patch
More file actions
88 lines (82 loc) · 3.87 KB
/
patch_linked_list.picoquic.patch
File metadata and controls
88 lines (82 loc) · 3.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
diff --git a/picoquic/frames.c b/picoquic/frames.c
index eeec90ba..a3bb1957 100644
--- a/picoquic/frames.c
+++ b/picoquic/frames.c
@@ -238,6 +238,7 @@ uint8_t * picoquic_format_stream_reset_frame(picoquic_cnx_t* cnx, picoquic_strea
free(stream->send_queue);
stream->send_queue = next;
}
+ stream->send_queue_end = NULL;
(void)picoquic_delete_stream_if_closed(cnx, stream);
}
else {
@@ -1539,6 +1540,7 @@ uint8_t * picoquic_format_stream_frame(picoquic_cnx_t* cnx, picoquic_stream_head
free(stream->send_queue->bytes);
free(stream->send_queue);
stream->send_queue = next;
+ if (!stream->send_queue) stream->send_queue_end = NULL;
}
stream->sent_offset += length;
@@ -1922,6 +1924,7 @@ uint8_t* picoquic_format_crypto_hs_frame(picoquic_stream_head_t* stream, uint8_t
free(stream->send_queue->bytes);
free(stream->send_queue);
stream->send_queue = next;
+ if (!stream->send_queue) stream->send_queue_end = NULL;
}
stream->sent_offset += length;
diff --git a/picoquic/picoquic_internal.h b/picoquic/picoquic_internal.h
index 6b4d3042..a08f0b39 100644
--- a/picoquic/picoquic_internal.h
+++ b/picoquic/picoquic_internal.h
@@ -777,6 +777,7 @@ typedef struct st_picoquic_stream_head_t {
picosplay_tree_t stream_data_tree; /* splay of received stream segments */
uint64_t sent_offset; /* Amount of data sent in the stream */
picoquic_stream_queue_node_t* send_queue; /* if the stream is not "active", list of data segments ready to send */
+ picoquic_stream_queue_node_t* send_queue_end; /* if the stream is not "active", list of data segments ready to send */
void * app_stream_ctx;
picoquic_stream_direct_receive_fn direct_receive_fn; /* direct receive function, if not NULL */
void* direct_receive_ctx; /* direct receive context */
diff --git a/picoquic/quicctx.c b/picoquic/quicctx.c
index 03d6d5a2..f63cd04f 100644
--- a/picoquic/quicctx.c
+++ b/picoquic/quicctx.c
@@ -2481,6 +2481,7 @@ void picoquic_clear_stream(picoquic_stream_head_t* stream)
free(next);
}
stream->send_queue = NULL;
+ stream->send_queue_end = NULL;
picosplay_empty_tree(&stream->stream_data_tree);
picoquic_sack_list_free(&stream->sack_list);
}
diff --git a/picoquic/sender.c b/picoquic/sender.c
index 539ddbe0..8c6a89b1 100644
--- a/picoquic/sender.c
+++ b/picoquic/sender.c
@@ -207,20 +207,27 @@ int picoquic_add_to_stream_with_ctx(picoquic_cnx_t* cnx, uint64_t stream_id,
stream_data = NULL;
ret = -1;
} else {
- picoquic_stream_queue_node_t** pprevious = &stream->send_queue;
- picoquic_stream_queue_node_t* next = stream->send_queue;
+ //picoquic_stream_queue_node_t** pprevious = &stream->send_queue;
+ picoquic_stream_queue_node_t* end = stream->send_queue_end;
memcpy(stream_data->bytes, data, length);
stream_data->length = length;
stream_data->offset = 0;
stream_data->next_stream_data = NULL;
- while (next != NULL) {
+ /*while (next != NULL) {
pprevious = &next->next_stream_data;
next = next->next_stream_data;
+ }*/
+
+ if (!end) {
+ stream->send_queue = stream_data;
+ } else {
+ end->next_stream_data = stream_data;
}
+ stream->send_queue_end = stream_data;
- *pprevious = stream_data;
+ //*pprevious = stream_data;
}
}