Refactor ejabberd_c2s:wait_for_stream/2 #495
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Local tests and coverage reports show almost complete coverage of the refactored FSM state. Testing against the version just before refactoring shows similar coverage and the same tests pass without modification.
I couldn't come up with a test case which would fall into
wait_for_stream({xmlstreamelement, _}, ...)
clause - if the first element sent on a newly opened socket is not<stream:stream>
it still gets passed to the function wrapped as{xmlstreamstart, _, _}
, not{xmlstreamelement, _}
. See https://github.com/esl/ejabberd_tests/tree/element-before-stream-start for a tried but finally dropped approach. It's probably something lower (even lower thanejabberd_receiver
, probably XML parser inxml
).Ready to merge once Travis passes.