Skip to content

Commit

Permalink
Merge pull request #52 from stephenc-pace/fix/closing-streams
Browse files Browse the repository at this point in the history
Prevent reusing stream ids
  • Loading branch information
timbu committed Sep 21, 2023
2 parents fcd1fac + 64e7fb0 commit 2f41946
Showing 1 changed file with 4 additions and 1 deletion.
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()

def settings_changed(self, event):
log.debug("settings changed")
Expand Down

0 comments on commit 2f41946

Please sign in to comment.