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

Report sockets opened by debugpy #1337

Closed
paulacamargo25 opened this issue Jul 27, 2023 · 1 comment
Closed

Report sockets opened by debugpy #1337

paulacamargo25 opened this issue Jul 27, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request P1

Comments

@paulacamargo25
Copy link

In order to implement the Port Attributes API. We need to know the port info that debugpy generates for the debugging process. You can send this as a log message that we can track and then disable port forwarding on those ports.

@int19h int19h added the enhancement New feature or request label Sep 12, 2023
@int19h int19h self-assigned this Sep 12, 2023
@int19h int19h added the P1 label Sep 28, 2023
@int19h int19h changed the title Get port info from debugpy Report sockets opened by debugpy Oct 3, 2023
int19h added a commit to int19h/debugpy that referenced this issue Oct 3, 2023
Send "debugpySockets" event with information about opened sockets when clients connect and whenever ports get opened or closed.
int19h added a commit to int19h/debugpy that referenced this issue Oct 3, 2023
Send "debugpySockets" event with information about opened sockets when clients connect and whenever ports get opened or closed.
@int19h
Copy link
Collaborator

int19h commented Oct 3, 2023

@paulacamargo25
The protocol is as follows: when client connects to the adapter, unless it is a secondary session (i.e. subprocess attach), it receives a debugpySockets event looking something like this:

        {
              "seq": 6,
              "type": "event",
              "event": "debugpySockets",
              "body": {
                  "sockets": [
                      {
                          "host": "127.0.0.1",
                          "port": 63435,
                          "internal": false
                      },
                      {
                          "host": "127.0.0.1",
                          "port": 63437,
                          "internal": true
                      },
                      {
                          "host": "127.0.0.1",
                          "port": 63436,
                          "internal": true
                      }
                  ]
              }
          }

Thereafter, such events are sent whenever the adapter opens or closes a port, with the content of "sockets" updated accordingly. At any given moment, the only ports that should be forwarded are those that were present in the most recent such event with ["internal"] === false.

See #1404 for implementation.

int19h added a commit to int19h/debugpy that referenced this issue Oct 3, 2023
Send "debugpySockets" event with information about opened sockets when clients connect and whenever ports get opened or closed.
@int19h int19h closed this as completed in ef9a67f Oct 6, 2023
int19h added a commit that referenced this issue Dec 12, 2023
Send "debugpySockets" event with information about opened sockets when clients connect and whenever ports get opened or closed.
int19h added a commit to int19h/debugpy that referenced this issue Dec 15, 2023
Send "debugpySockets" event with information about opened sockets when clients connect and whenever ports get opened or closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P1
Projects
None yet
Development

No branches or pull requests

2 participants