33#include " application.h"
44#include < async_wrap-inl.h>
55#include < debug_utils-inl.h>
6+ #include < ngtcp2/ngtcp2.h>
67#include < node_bob.h>
78#include < node_sockaddr-inl.h>
8- #include < ngtcp2/ngtcp2.h>
99#include < uv.h>
1010#include < v8.h>
1111#include " defs.h"
@@ -246,8 +246,7 @@ void Session::Application::SendPendingData() {
246246
247247 // The maximum number of packets to send in this call to SendPendingData.
248248 const size_t max_packet_count = std::min (
249- kMaxPackets ,
250- ngtcp2_conn_get_send_quantum (*session_) / max_packet_size);
249+ kMaxPackets , ngtcp2_conn_get_send_quantum (*session_) / max_packet_size);
251250
252251 // The number of packets that have been sent in this call to SendPendingData.
253252 size_t packet_send_count = 0 ;
@@ -295,11 +294,12 @@ void Session::Application::SendPendingData() {
295294 Debug (session_, " Application using stream data: %s" , stream_data);
296295
297296 // Awesome, let's write our packet!
298- ssize_t nwrite = WriteVStream (&path, pos, &ndatalen, max_packet_size, stream_data);
297+ ssize_t nwrite =
298+ WriteVStream (&path, pos, &ndatalen, max_packet_size, stream_data);
299299 Debug (session_, " Application accepted %zu bytes into packet" , ndatalen);
300300
301- // A negative nwrite value indicates either an error or that there is more data
302- // to write into the packet.
301+ // A negative nwrite value indicates either an error or that there is more
302+ // data to write into the packet.
303303 if (nwrite < 0 ) {
304304 switch (nwrite) {
305305 case NGTCP2_ERR_STREAM_DATA_BLOCKED: {
@@ -317,7 +317,8 @@ void Session::Application::SendPendingData() {
317317 // Indicates that the writable side of the stream should be closed
318318 // locally or the stream is being reset. In either case, we can't send
319319 // any stream data!
320- Debug (session_, " Stream %" PRIi64 " should be closed for writing" ,
320+ Debug (session_,
321+ " Stream %" PRIi64 " should be closed for writing" ,
321322 stream_data.id );
322323 // ndatalen = -1 means that no stream data was accepted into the
323324 // packet, which is what we want here.
@@ -341,7 +342,8 @@ void Session::Application::SendPendingData() {
341342
342343 // Some other type of error happened.
343344 DCHECK_EQ (ndatalen, -1 );
344- Debug (session_, " Application encountered error while writing packet: %s" ,
345+ Debug (session_,
346+ " Application encountered error while writing packet: %s" ,
345347 ngtcp2_strerror (nwrite));
346348 session_->SetLastError (QuicError::ForNgtcp2Error (nwrite));
347349 packet->Done (UV_ECANCELED);
@@ -363,14 +365,16 @@ void Session::Application::SendPendingData() {
363365 size_t datalen = pos - begin;
364366 if (datalen) {
365367 Debug (session_, " Packet has %zu bytes to send" , datalen);
366- // At least some data had been written into the packet. We should send it.
368+ // At least some data had been written into the packet. We should send
369+ // it.
367370 packet->Truncate (datalen);
368371 session_->Send (packet, path);
369372 } else {
370373 packet->Done (UV_ECANCELED);
371374 }
372375
373- // If there was stream data selected, we should reschedule it to try sending again.
376+ // If there was stream data selected, we should reschedule it to try
377+ // sending again.
374378 if (stream_data.id >= 0 ) ResumeStream (stream_data.id );
375379
376380 return session_->UpdatePacketTxTime ();
@@ -403,18 +407,17 @@ ssize_t Session::Application::WriteVStream(PathStorage* path,
403407 uint32_t flags = NGTCP2_WRITE_STREAM_FLAG_MORE;
404408 if (stream_data.fin ) flags |= NGTCP2_WRITE_STREAM_FLAG_FIN;
405409 ngtcp2_pkt_info pi;
406- return ngtcp2_conn_writev_stream (
407- *session_,
408- &path->path ,
409- &pi,
410- dest,
411- max_packet_size,
412- ndatalen,
413- flags,
414- stream_data.id ,
415- stream_data.buf ,
416- stream_data.count ,
417- uv_hrtime ());
410+ return ngtcp2_conn_writev_stream (*session_,
411+ &path->path ,
412+ &pi,
413+ dest,
414+ max_packet_size,
415+ ndatalen,
416+ flags,
417+ stream_data.id ,
418+ stream_data.buf ,
419+ stream_data.count ,
420+ uv_hrtime ());
418421}
419422
420423// The DefaultApplication is the default implementation of Session::Application
0 commit comments