Skip to content

Commit fa84d48

Browse files
committed
fixup! quic: extract transport logic from Application to Session
Convert fin to bool
1 parent 157417a commit fa84d48

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

src/quic/application.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ class DefaultApplication final : public Session::Application {
339339
// Reset the state of stream_data before proceeding...
340340
stream_data->id = -1;
341341
stream_data->count = 0;
342-
stream_data->fin = 0;
342+
stream_data->fin = false;
343343
stream_data->stream.reset();
344344
Debug(&session(), "Default application getting stream data");
345345
DCHECK_NOT_NULL(stream_data);
@@ -362,7 +362,7 @@ class DefaultApplication final : public Session::Application {
362362
case bob::Status::STATUS_WAIT:
363363
return;
364364
case bob::Status::STATUS_EOS:
365-
stream_data->fin = 1;
365+
stream_data->fin = true;
366366
}
367367

368368
// It is possible that the data pointers returned are not actually
@@ -393,10 +393,10 @@ class DefaultApplication final : public Session::Application {
393393
arraysize(stream_data->data),
394394
kMaxVectorCount);
395395
if (ret == bob::Status::STATUS_EOS) {
396-
stream_data->fin = 1;
396+
stream_data->fin = true;
397397
}
398398
} else {
399-
stream_data->fin = 1;
399+
stream_data->fin = true;
400400
}
401401

402402
return 0;

src/quic/http3.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,16 +680,19 @@ class Http3ApplicationImpl final : public Session::Application {
680680
ssize_t ret = 0;
681681
Debug(&session(), "HTTP/3 application getting stream data");
682682
if (conn_ && session().max_data_left()) {
683+
// nghttp3 reports fin through an int out-param; bridge it to the bool.
684+
int fin = 0;
683685
ret =
684686
nghttp3_conn_writev_stream(*this,
685687
&data->id,
686-
&data->fin,
688+
&fin,
687689
reinterpret_cast<nghttp3_vec*>(data->data),
688690
data->count);
689691
// A negative return value indicates an error.
690692
if (ret < 0) {
691693
return static_cast<int>(ret);
692694
}
695+
data->fin = fin != 0;
693696

694697
data->count = static_cast<size_t>(ret);
695698
if (data->id >= 0 && data->id != control_stream_id_ &&

src/quic/session.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ class Session final : public AsyncWrap, private SessionTicket::AppData::Source {
113113
// The stream identifier. If this is a negative value then no stream is
114114
// identified.
115115
stream_id id = -1;
116-
int fin = 0;
116+
bool fin = false;
117117
ngtcp2_vec data[kMaxVectorCount]{};
118118
BaseObjectPtr<Stream> stream;
119119

0 commit comments

Comments
 (0)