Eyepea / aiosip

SIP support for AsyncIO (DEPRECATED)
Apache License 2.0
82 stars 41 forks source link

Always copy provided headers #50

Closed vodik closed 6 years ago

vodik commented 6 years ago

Fixes an issue where notify message with extra headers, when sent in a loop, ends up with a pinned CSeq number.

Since the header structure is filled in before serializing and sending on the wire - and not copied - we end up filling in the data structure provided in the header named parameter.

This effectively leaks and shares state between distinct transactions.

vodik commented 6 years ago

I should really figure out how to write a test around this...

codecov-io commented 6 years ago

Codecov Report

Merging #50 into master will increase coverage by 0.18%. The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage   74.48%   74.66%   +0.18%     
==========================================
  Files          15       15              
  Lines        1360     1354       -6     
  Branches      250      244       -6     
==========================================
- Hits         1013     1011       -2     
+ Misses        233      232       -1     
+ Partials      114      111       -3
Impacted Files Coverage Δ
aiosip/dialog.py 76.78% <0%> (+1.13%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update fc75f04...9b83f4b. Read the comment docs.

vodik commented 6 years ago

@dtkerr: this fixes the SUBSCRIBE/NOTIFY issue around the phone testing.

vodik commented 6 years ago

For a little more information, here's the snippet that causes the problem:

    headers = {'Event': 'dialog',
               'Content-Type': 'application/dialog-info+xml'}

    while True:
        payload = "...<snip>..."
        await dialog.notify(headers=headers, payload=payload)