Lines Matching defs:session

74 // Http2Scope h2scope(session);
75 // nghttp2_submit_ping(session->session(), ... );
79 Http2Scope::Http2Scope(Http2Stream* stream) : Http2Scope(stream->session()) {}
81 Http2Scope::Http2Scope(Http2Session* session) : session_(session) {
114 // We manually handle flow control within a session in order to
160 // this is set on a per-session basis, but eventually we may switch to
170 // header pairs the session may accept. This is a hard limit.. that is,
193 // that a session can consume. In order to prevent abuse, we place a
194 // cap on the amount of memory a session can consume at any given time.
238 Http2Settings::Http2Settings(Http2Session* session,
242 : AsyncWrap(session->env(), obj, PROVIDER_HTTP2SETTINGS),
243 session_(session),
246 count_ = Init(session->http2_state(), entries_);
292 // the session.
293 void Http2Settings::Update(Http2Session* session, get_setting fn) {
294 AliasedUint32Array& buffer = session->http2_state()->settings_buffer;
298 fn(session->session(), NGHTTP2_SETTINGS_ ## name);
323 session_->session(),
481 // Capture the configuration options for this session
511 nghttp2_session* session;
513 &session,
518 session_.reset(session);
530 Debug(this, "freeing nghttp2 session");
532 // on to are destroyed before the nghttp2 session is.
638 CHECK_NOT_NULL(session());
678 // Closes the session and frees the associated resources
680 Debug(this, "closing session");
697 Debug(this, "terminating session with code %d", code);
708 Debug(this, "make done session callback");
891 Http2Session* session = static_cast<Http2Session*>(user_data);
893 Debug(session, "beginning headers for stream %d", id);
895 BaseObjectPtr<Http2Stream> stream = session->FindStream(id);
899 if (UNLIKELY(!session->CanAddStream() ||
900 Http2Stream::New(session, id, frame->headers.cat) ==
902 if (session->rejected_stream_count_++ >
903 session->js_fields_->max_rejected_streams)
907 session->session(),
914 session->rejected_stream_count_ = 0;
930 Http2Session* session = static_cast<Http2Session*>(user_data);
932 BaseObjectPtr<Http2Stream> stream = session->FindStream(id);
955 Http2Session* session = static_cast<Http2Session*>(user_data);
956 session->statistics_.frame_count++;
957 Debug(session, "complete frame received: type: %d",
961 return session->HandleDataFrame(frame);
965 session->HandleHeadersFrame(frame);
968 session->HandleSettingsFrame(frame);
971 session->HandlePriorityFrame(frame);
974 session->HandleGoawayFrame(frame);
977 session->HandlePingFrame(frame);
980 session->HandleAltSvcFrame(frame);
983 session->HandleOriginFrame(frame);
995 Http2Session* session = static_cast<Http2Session*>(user_data);
996 const uint32_t max_invalid_frames = session->js_fields_->max_invalid_frames;
998 Debug(session,
1000 session->invalid_frame_count_,
1003 if (session->invalid_frame_count_++ > max_invalid_frames) {
1004 session->custom_recv_error_code_ = "ERR_HTTP2_TOO_MANY_INVALID_FRAMES";
1011 Environment* env = session->env();
1017 session->MakeCallback(env->http2session_on_error_function(), 1, &arg);
1060 // closing down the session or stream, we go ahead and ignore it. We don't
1068 Http2Session* session = static_cast<Http2Session*>(user_data);
1069 Environment* env = session->env();
1070 Debug(session, "frame type %d was not sent, code: %d",
1073 // Do not report if the frame was not sent due to the session closing
1079 // to destroy the session completely.
1081 session->DecrefHeaders(frame);
1095 session->MakeCallback(
1104 Http2Session* session = static_cast<Http2Session*>(user_data);
1105 session->statistics_.frame_sent += 1;
1114 Http2Session* session = static_cast<Http2Session*>(user_data);
1115 Environment* env = session->env();
1120 Debug(session, "stream %d closed with code: %d", id, code);
1121 BaseObjectPtr<Http2Stream> stream = session->FindStream(id);
1148 int Http2Session::OnInvalidHeader(nghttp2_session* session,
1168 Http2Session* session = static_cast<Http2Session*>(user_data);
1169 Debug(session, "buffering data chunk for stream %d, size: "
1171 Environment* env = session->env();
1183 BaseObjectPtr<Http2Stream> stream = session->FindStream(id);
1194 // know about the HTTP2 session associated with this stream, so they know
1224 if (session->outgoing_length_ > 4096 ||
1226 session->SendPendingData();
1232 if (session->is_write_in_progress()) {
1233 CHECK(session->is_reading_stopped());
1234 session->set_receive_paused();
1235 Debug(session, "receive paused");
1248 Http2Session* session = static_cast<Http2Session*>(user_data);
1251 switch (session->padding_strategy_) {
1256 padding = session->OnMaxFrameSizePadding(padding, maxPayloadLen);
1259 padding = session->OnDWordAlignedPadding(padding, maxPayloadLen);
1273 // the session errored because the peer is not an http2 peer.
1274 Http2Session* session = static_cast<Http2Session*>(user_data);
1275 Debug(session, "Error '%s'", message);
1277 Environment* env = session->env();
1283 session->MakeCallback(env->http2session_on_error_function(), 1, &arg);
1296 Http2Session* session = stream->session();
1307 if (session->stream_buf_ab_.IsEmpty()) {
1309 std::move(session->stream_buf_allocation_));
1310 session->stream_buf_ab_.Reset(env->isolate(), ab);
1312 ab = PersistentToLocal::Strong(session->stream_buf_ab_);
1318 size_t offset = buf.base - session->stream_buf_.base;
1321 CHECK_GE(offset, session->stream_buf_offset_);
1322 CHECK_LE(offset, session->stream_buf_.len);
1323 CHECK_LE(offset + buf.len, session->stream_buf_.len);
1537 // Notify the session that a ping occurred
1638 // or the session was destroyed in the meantime.
1654 // If the session is already closing we don't want to stop reading as we want
1824 Http2Session* session = static_cast<Http2Session*>(user_data);
1825 BaseObjectPtr<Http2Stream> stream = session->FindStream(frame->hd.stream_id);
1829 session->CopyDataIntoOutgoing(framehd, 9);
1833 session->CopyDataIntoOutgoing(&padding_byte, 1);
1836 Debug(session, "nghttp2 has %d bytes to send directly", length);
1846 session->PushOutgoingBuffer(std::move(write));
1852 session->PushOutgoingBuffer(NgHttp2StreamWrite {
1862 session->PushOutgoingBuffer(NgHttp2StreamWrite {
1975 // Every Http2Session session is tightly bound to a single i/o StreamBase
1990 Http2Session* session;
1991 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
1997 Debug(session, "Receiving %zu bytes injected from JS", len);
2001 uv_buf_t buf = session->OnStreamAlloc(len);
2005 session->OnStreamRead(copy, buf);
2012 Http2Stream* Http2Stream::New(Http2Session* session,
2017 if (!session->env()
2019 ->NewInstance(session->env()->context())
2023 return new Http2Stream(session, obj, id, category, options);
2026 Http2Stream::Http2Stream(Http2Session* session,
2031 : AsyncWrap(session->env(), obj, AsyncWrap::PROVIDER_HTTP2STREAM),
2032 StreamBase(session->env()),
2033 session_(session),
2042 max_header_pairs_ = session->max_header_pairs();
2052 session->session(),
2063 session->AddStream(this);
2076 const Http2Session* sess = session();
2078 sess ? sess->diagnostic_name() : "session already destroyed";
2098 return nghttp2_session_find_stream(session_->session(), id_);
2122 session_->session(), id_),
2161 if (session() == nullptr ||
2162 !session()->HasWritesOnSocketForStream(this)) {
2191 session_->session(),
2207 session_->session(),
2241 session_->session(),
2247 session_->session(),
2264 session_->session(),
2268 session_->session(),
2316 session_->session(),
2331 session_->session(),
2359 session_->session(),
2408 session_->session(),
2429 // of headers and the session has memory available for it.
2481 Http2Session* session = static_cast<Http2Session*>(user_data);
2482 Debug(session, "reading outbound data for stream %d", id);
2483 BaseObjectPtr<Http2Stream> stream = session->FindStream(id);
2504 Debug(session, "stream %d has pending outbound data", id);
2506 Debug(session, "sending %d bytes for data frame on stream %d", amount, id);
2517 Debug(session, "deferring stream %d", id);
2527 Debug(session, "no more data for stream %d", id);
2583 Http2Session* session;
2584 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2586 if (nghttp2_session_set_next_stream_id(session->session(), id) < 0) {
2587 Debug(session, "failed to set next stream id to %d", id);
2591 Debug(session, "set next stream id to %d", id);
2600 Http2Session* session;
2601 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2606 session->session(), NGHTTP2_FLAG_NONE, 0, window_size);
2610 Debug(session, "set local window size to %d", window_size);
2618 Http2Session* session;
2619 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2620 Http2Settings::Update(session, fn);
2621 Debug(session, "settings refreshed for session");
2628 Http2Session* session;
2629 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2630 Debug(session, "refreshing state");
2632 AliasedFloat64Array& buffer = session->http2_state()->session_state_buffer;
2634 nghttp2_session* s = session->session();
2665 Http2Session* session = new Http2Session(state, args.This(), type);
2666 Debug(session, "session created");
2672 Http2Session* session;
2673 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2675 session->Consume(args[0].As<Object>());
2680 Http2Session* session;
2681 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2682 Debug(session, "destroying session");
2687 session->Close(code, args[1]->IsTrue());
2693 Http2Session* session;
2694 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2695 Environment* env = session->env();
2700 Debug(session, "request submitted");
2704 session->Http2Session::SubmitRequest(
2711 Debug(session, "could not submit request: %s", nghttp2_strerror(ret));
2715 Debug(session, "request submitted, new stream id %d", stream->id());
2744 Http2Session* session;
2745 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2755 session->Goaway(code, lastStreamID, opaque_data.data(), opaque_data.length());
2764 Http2Session* session;
2765 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2767 uint32_t length = session->chunks_sent_since_last_write_;
2769 session->object()->Set(env->context(),
2892 CHECK_NOT_NULL(stream->session());
2894 stream->session()->http2_state()->stream_state_buffer;
2897 nghttp2_session* s = stream->session()->session();
2944 Http2Session* session;
2945 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2969 session->AltSvc(id, *origin, origin_len, *value, value_len);
2975 Http2Session* session;
2976 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2981 session->Origin(Origins(env, origin_string, count));
2986 Http2Session* session;
2987 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
2999 session->AddPing(payload.data(), args[1].As<Function>()));
3004 Http2Session* session;
3005 ASSIGN_OR_RETURN_UNWRAP(&session, args.Holder());
3007 args.GetReturnValue().Set(session->AddSettings(args[0].As<Function>()));
3084 Http2Session* session,
3087 : AsyncWrap(session->env(), obj, AsyncWrap::PROVIDER_HTTP2PING),
3088 session_(session),
3110 session_->session(),
3197 // Initialize the buffer used to store the session state
3261 Local<FunctionTemplate> session =
3263 session->InstanceTemplate()->SetInternalFieldCount(
3265 session->Inherit(AsyncWrap::GetConstructorTemplate(env));
3266 SetProtoMethod(isolate, session, "origin", Http2Session::Origin);
3267 SetProtoMethod(isolate, session, "altsvc", Http2Session::AltSvc);
3268 SetProtoMethod(isolate, session, "ping", Http2Session::Ping);
3269 SetProtoMethod(isolate, session, "consume", Http2Session::Consume);
3270 SetProtoMethod(isolate, session, "receive", Http2Session::Receive);
3271 SetProtoMethod(isolate, session, "destroy", Http2Session::Destroy);
3272 SetProtoMethod(isolate, session, "goaway", Http2Session::Goaway);
3273 SetProtoMethod(isolate, session, "settings", Http2Session::Settings);
3274 SetProtoMethod(isolate, session, "request", Http2Session::Request);
3276 isolate, session, "setNextStreamID", Http2Session::SetNextStreamID);
3278 isolate, session, "setLocalWindowSize", Http2Session::SetLocalWindowSize);
3280 isolate, session, "updateChunksSent", Http2Session::UpdateChunksSent);
3281 SetProtoMethod(isolate, session, "refreshState", Http2Session::RefreshState);
3284 session,
3289 session,
3292 SetConstructorFunction(context, target, "Http2Session", session);