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

Agent handles any inbound package (as opposed to STUN only) #370

Merged
merged 1 commit into from Jan 21, 2019

Conversation

Projects
None yet
3 participants
@hugoArregui
Copy link
Member

hugoArregui commented Jan 21, 2019

This way, we update lastReceived properly, not just for STUN messages.

We are using lastReceived to check for a connection timeout (https://github.com/pions/webrtc/blob/master/pkg/ice/agent.go#L442) but the problem was we were not updating lastReceived for non STUN messages

continue
m := buffer[:n]
err = c.agent.run(func(agent *Agent) {
agent.handleInbound(m, c, srcAddr)

This comment has been minimized.

@backkem

backkem Jan 21, 2019

Member

There is a known problem here: run is executed asynchronously. This means the buffer will be used concurrently in the recvLoop and the code executed by run. This can cause corruption of the buffer. This change makes this problem worse since it now occurs with every package, not just the STUN packages.
We intend to solve the original problem by making a copy of the buffer before passing it to the run method. However, this solution doesn't seem appropriate for this case since we would have to make a copy for all incoming data and the copy would mostly not be used. I suggest to split this up again: have a separate call to run for user data that finds the right remote candidate and marks it as seen.

@coveralls

This comment has been minimized.

Copy link

coveralls commented Jan 21, 2019

Pull Request Test Coverage Report for Build 1836

  • 10 of 12 (83.33%) changed or added relevant lines in 2 files are covered.
  • 25 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.3%) to 76.667%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/ice/candidate.go 5 7 71.43%
Files with Coverage Reduction New Missed Lines %
pkg/ice/agent.go 2 84.54%
pkg/ice/candidate.go 2 90.79%
internal/srtp/stream_srtcp.go 3 45.24%
internal/srtp/session_srtcp.go 5 74.12%
rtcpeerconnection.go 13 74.47%
Totals Coverage Status
Change from base Build 1827: -0.3%
Covered Lines: 5083
Relevant Lines: 6630

💛 - Coveralls

@hugoArregui hugoArregui force-pushed the hugoArregui:topic-agent-handleinbound branch 2 times, most recently from cf65dcd to 6976b5e Jan 21, 2019

@backkem
Copy link
Member

backkem left a comment

Looking good, couple of small suggestions.

Show resolved Hide resolved pkg/ice/agent.go Outdated
Show resolved Hide resolved pkg/ice/agent.go Outdated
Show resolved Hide resolved pkg/ice/agent.go Outdated
Show resolved Hide resolved pkg/ice/candidate.go Outdated

@hugoArregui hugoArregui force-pushed the hugoArregui:topic-agent-handleinbound branch from 6976b5e to 3d04f66 Jan 21, 2019

Agent handles any inbound package
- STUN messages are still handled by handleInboundPackage
- Non STUN messsage will be marked as seen by a new agent method called
  NoSTUNSeen. This way we update lastReceived properly, not just for
  STUN messages

@hugoArregui hugoArregui force-pushed the hugoArregui:topic-agent-handleinbound branch from 3d04f66 to 072ebb7 Jan 21, 2019

@hugoArregui

This comment has been minimized.

Copy link
Member Author

hugoArregui commented Jan 21, 2019

@backkem done! I now realize there is a way to apply your suggestion directly in GH :-D

@backkem backkem merged commit dfafda9 into pions:master Jan 21, 2019

1 of 2 checks passed

coverage/coveralls Coverage decreased (-0.3%) to 76.667%
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@hugoArregui hugoArregui deleted the hugoArregui:topic-agent-handleinbound branch Jan 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment