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

Prevent reusing stream ids #52

Merged
merged 3 commits into from
Sep 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9

Expand All @@ -33,7 +33,7 @@ jobs:
TOXENV: static

test:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
strategy:
matrix:
python-version:
Expand All @@ -44,10 +44,10 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand All @@ -74,10 +74,10 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: setup python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.9

Expand Down
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@ __pycache__
.tox
*_pb2.py
*_pb2_grpc.py
.coverage
.coverage
.DS_Store
.idea/
build/
dist/
5 changes: 4 additions & 1 deletion nameko_grpc/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,15 @@ def stream_ended(self, event):
def stream_reset(self, event):
"""Called when an incoming stream is reset.

Close any `ReceiveStream` that was opened for this stream.
Close any Streams that we have opened for this stream_id
"""
log.debug("stream reset, stream %s", event.stream_id)
receive_stream = self.receive_streams.pop(event.stream_id, None)
if receive_stream:
receive_stream.close()
send_stream = self.send_streams.pop(event.stream_id, None)
if send_stream:
send_stream.close()
Copy link
Collaborator Author

@stephenc-pace stephenc-pace Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Enusre our reference to the stream is closed.


def settings_changed(self, event):
log.debug("settings changed")
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ envlist = static, {py3.6,py3.7,py3.8,py3.9}-test
skipsdist = True

[testenv]
whitelist_externals = make
allowlist_externals = make

commands =
static: pip install pre-commit
Expand Down