GoogleChrome / GoogleChrome/samples

Why we use magic number 2 at quic_transport_server.py

Open
#820 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.9k
Forks
2.4k
Avg merge
24m
Merged PRs (30d)
2

Description

Hello, everyone(maybe I should @vasilvv specially..), I read your demo code [quic-transport](https://github.com/GoogleChrome/samples/blob/gh-pages/quictransport/quic_transport_server.py).

But there are a little code makes me little confusion:
``` python
if isinstance(event, StreamDataReceived) and event.stream_id == 2: // [+] @a
self.client_indication_data += event.data
if event.end_stream:
self.process_client_indication()
if self.is_closing_or_closed():
return
# Pass all buffered events into the handler now that it's
# available.
for e in self.pending_events:
self.handler.quic_event_received(e)
self.pending_events.clear()
else:
# We have received some application data before we have the
# request URL available, which is possible since there is no
# ordering guarantee on data between different QUIC streams.
# Buffer the data for now.
self.pending_events.append(event)
```

at @a, we use a magic number which is 2, I have 3 question about this:
1. what does it means at here.
2. Why we should use 2 instead of 3, 4, 5, etc...
3. Which document or source code introduce this?

Thank u very much!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.