From 63a50b1ccf649b60b681f692b6c6d867990505c5 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sat, 21 Nov 2015 15:07:55 +0900 Subject: [PATCH] Add nghttp2_session_check_server_session() API This is very simple API, and it returns nonzero if session is initialized as server. --- lib/includes/nghttp2/nghttp2.h | 8 ++++++++ lib/nghttp2_session.c | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/lib/includes/nghttp2/nghttp2.h b/lib/includes/nghttp2/nghttp2.h index 7515555c..d4ba7e3d 100644 --- a/lib/includes/nghttp2/nghttp2.h +++ b/lib/includes/nghttp2/nghttp2.h @@ -3616,6 +3616,14 @@ nghttp2_session_get_last_proc_stream_id(nghttp2_session *session); NGHTTP2_EXTERN int nghttp2_session_check_request_allowed(nghttp2_session *session); +/** + * @function + * + * Returns nonzero if |session| is initialized as server side session. + */ +NGHTTP2_EXTERN int +nghttp2_session_check_server_session(nghttp2_session *session); + /** * @function * diff --git a/lib/nghttp2_session.c b/lib/nghttp2_session.c index da678409..64e39da5 100644 --- a/lib/nghttp2_session.c +++ b/lib/nghttp2_session.c @@ -6767,3 +6767,7 @@ nghttp2_stream *nghttp2_session_find_stream(nghttp2_session *session, nghttp2_stream *nghttp2_session_get_root_stream(nghttp2_session *session) { return &session->root; } + +int nghttp2_session_check_server_session(nghttp2_session *session) { + return session->server; +}