Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
8f038ae4
Commit
8f038ae4
authored
Mar 15, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added spdylay_session_get_outbound_queue_size()
parent
b8e4116f
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
53 additions
and
0 deletions
+53
-0
lib/includes/spdylay/spdylay.h
lib/includes/spdylay/spdylay.h
+8
-0
lib/spdylay_pq.c
lib/spdylay_pq.c
+5
-0
lib/spdylay_pq.h
lib/spdylay_pq.h
+5
-0
lib/spdylay_session.c
lib/spdylay_session.c
+5
-0
tests/main.c
tests/main.c
+2
-0
tests/spdylay_pq_test.c
tests/spdylay_pq_test.c
+8
-0
tests/spdylay_session_test.c
tests/spdylay_session_test.c
+19
-0
tests/spdylay_session_test.h
tests/spdylay_session_test.h
+1
-0
No files found.
lib/includes/spdylay/spdylay.h
View file @
8f038ae4
...
...
@@ -1199,6 +1199,14 @@ int spdylay_session_want_write(spdylay_session *session);
void
*
spdylay_session_get_stream_user_data
(
spdylay_session
*
session
,
int32_t
stream_id
);
/**
* @function
*
* Returns the number of frames in the outbound queue. This does not
* include the deferred DATA frames.
*/
size_t
spdylay_session_get_outbound_queue_size
(
spdylay_session
*
session
);
/**
* @function
*
...
...
lib/spdylay_pq.c
View file @
8f038ae4
...
...
@@ -120,3 +120,8 @@ int spdylay_pq_empty(spdylay_pq *pq)
{
return
pq
->
length
==
0
;
}
size_t
spdylay_pq_size
(
spdylay_pq
*
pq
)
{
return
pq
->
length
;
}
lib/spdylay_pq.h
View file @
8f038ae4
...
...
@@ -91,4 +91,9 @@ void spdylay_pq_pop(spdylay_pq *pq);
*/
int
spdylay_pq_empty
(
spdylay_pq
*
pq
);
/*
* Returns the number of items in the queue |pq|.
*/
size_t
spdylay_pq_size
(
spdylay_pq
*
pq
);
#endif
/* SPDYLAY_PQ_H */
lib/spdylay_session.c
View file @
8f038ae4
...
...
@@ -2346,3 +2346,8 @@ uint8_t spdylay_session_get_pri_lowest(spdylay_session *session)
return
0
;
}
}
size_t
spdylay_session_get_outbound_queue_size
(
spdylay_session
*
session
)
{
return
spdylay_pq_size
(
&
session
->
ob_pq
)
+
spdylay_pq_size
(
&
session
->
ob_ss_pq
);
}
tests/main.c
View file @
8f038ae4
...
...
@@ -142,6 +142,8 @@ int main(int argc, char* argv[])
test_spdylay_session_on_settings_received
)
||
!
CU_add_test
(
pSuite
,
"session_submit_settings"
,
test_spdylay_submit_settings
)
||
!
CU_add_test
(
pSuite
,
"session_get_outbound_queue_size"
,
test_spdylay_session_get_outbound_queue_size
)
||
!
CU_add_test
(
pSuite
,
"frame_unpack_nv_spdy2"
,
test_spdylay_frame_unpack_nv_spdy2
)
||
!
CU_add_test
(
pSuite
,
"frame_unpack_nv_spdy3"
,
...
...
tests/spdylay_pq_test.c
View file @
8f038ae4
...
...
@@ -37,21 +37,29 @@ void test_spdylay_pq()
{
spdylay_pq
pq
;
spdylay_pq_init
(
&
pq
,
pq_compar
);
CU_ASSERT
(
spdylay_pq_empty
(
&
pq
));
CU_ASSERT
(
0
==
spdylay_pq_size
(
&
pq
));
CU_ASSERT
(
0
==
spdylay_pq_push
(
&
pq
,
"foo"
));
CU_ASSERT
(
0
==
spdylay_pq_empty
(
&
pq
));
CU_ASSERT
(
1
==
spdylay_pq_size
(
&
pq
));
CU_ASSERT
(
strcmp
(
"foo"
,
spdylay_pq_top
(
&
pq
))
==
0
);
CU_ASSERT
(
0
==
spdylay_pq_push
(
&
pq
,
"bar"
));
CU_ASSERT
(
strcmp
(
"bar"
,
spdylay_pq_top
(
&
pq
))
==
0
);
CU_ASSERT
(
0
==
spdylay_pq_push
(
&
pq
,
"baz"
));
CU_ASSERT
(
strcmp
(
"bar"
,
spdylay_pq_top
(
&
pq
))
==
0
);
CU_ASSERT
(
0
==
spdylay_pq_push
(
&
pq
,
"C"
));
CU_ASSERT
(
4
==
spdylay_pq_size
(
&
pq
));
CU_ASSERT
(
strcmp
(
"C"
,
spdylay_pq_top
(
&
pq
))
==
0
);
spdylay_pq_pop
(
&
pq
);
CU_ASSERT
(
3
==
spdylay_pq_size
(
&
pq
));
CU_ASSERT
(
strcmp
(
"bar"
,
spdylay_pq_top
(
&
pq
))
==
0
);
spdylay_pq_pop
(
&
pq
);
CU_ASSERT
(
strcmp
(
"baz"
,
spdylay_pq_top
(
&
pq
))
==
0
);
spdylay_pq_pop
(
&
pq
);
CU_ASSERT
(
strcmp
(
"foo"
,
spdylay_pq_top
(
&
pq
))
==
0
);
spdylay_pq_pop
(
&
pq
);
CU_ASSERT
(
spdylay_pq_empty
(
&
pq
));
CU_ASSERT
(
0
==
spdylay_pq_size
(
&
pq
));
CU_ASSERT
(
0
==
spdylay_pq_top
(
&
pq
));
spdylay_pq_free
(
&
pq
);
}
...
...
tests/spdylay_session_test.c
View file @
8f038ae4
...
...
@@ -2022,3 +2022,22 @@ void test_spdylay_submit_settings()
spdylay_session_del
(
session
);
}
void
test_spdylay_session_get_outbound_queue_size
()
{
spdylay_session
*
session
;
spdylay_session_callbacks
callbacks
;
const
char
*
nv
[]
=
{
"version"
,
"HTTP/1.1"
,
NULL
};
memset
(
&
callbacks
,
0
,
sizeof
(
spdylay_session_callbacks
));
CU_ASSERT
(
0
==
spdylay_session_client_new
(
&
session
,
SPDYLAY_PROTO_SPDY3
,
&
callbacks
,
NULL
));
CU_ASSERT
(
0
==
spdylay_session_get_outbound_queue_size
(
session
));
CU_ASSERT
(
0
==
spdylay_submit_syn_stream
(
session
,
SPDYLAY_CTRL_FLAG_FIN
,
1
,
7
,
nv
,
NULL
));
CU_ASSERT
(
1
==
spdylay_session_get_outbound_queue_size
(
session
));
CU_ASSERT
(
0
==
spdylay_submit_goaway
(
session
,
SPDYLAY_GOAWAY_OK
));
CU_ASSERT
(
2
==
spdylay_session_get_outbound_queue_size
(
session
));
}
tests/spdylay_session_test.h
View file @
8f038ae4
...
...
@@ -63,5 +63,6 @@ void test_spdylay_session_flow_control();
void
test_spdylay_session_on_ctrl_not_send
();
void
test_spdylay_session_on_settings_received
();
void
test_spdylay_submit_settings
();
void
test_spdylay_session_get_outbound_queue_size
();
#endif // SPDYLAY_SESSION_TEST_H
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment