Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why we use magic number 2 at quic_transport_server.py #820

Open
18Fl opened this issue Jan 4, 2024 · 1 comment
Open

Why we use magic number 2 at quic_transport_server.py #820

18Fl opened this issue Jan 4, 2024 · 1 comment

Comments

@18Fl
Copy link

18Fl commented Jan 4, 2024

Hello, everyone(maybe I should @vasilvv specially..), I read your demo code quic-transport.

But there are a little code makes me little confusion:

            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!

@18Fl
Copy link
Author

18Fl commented Jan 4, 2024

is it from this document?

In order to verify that the client's origin is allowed to connect to
the server in question, the user agent has to communicate the origin
to the server. This is accomplished by sending a special message,
called client indication, on stream 2, which is the first client-
initiated unidirectional stream.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant