Avoid calling gen_server:reply/2 with {from, From}
#54
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.
There was some inconsistency in these files (not between different files but inside a single file). In some places the
pending_recvfield (or similar) was set to{from, From}and other times toFrom; and in pattern-matching too, some places pattern-matched onnil/noneand{from, From}, others justFrom.I noticed this first in
chumak_req:terminate/2, wheregen_server:reply/2is called with thepending_recvfield, which somewhere else in the file is set to{from, From}. From thegen_server:reply/2docs I don't think this is accepted.To make things consistent inside files but also across different files, I tried replacing all
{from, From}tuples withFromeverywhere. Absence is marked by the symbolsnilornoneas before. I tried to fix pattern-matching orders in function clauses andcases but may have missed some.I find it weird that this hasn't caused problems in the past; maybe this was/is dead code?
I ran
rebar3 eunit -cand the only failed tests seemed to be related to cryptography (e.g.chumak_protocol_curve_test:messages_test/0: module 'chumak_protocol_curve_test') which shouldn't be affected by these changes. Still, wIll leave this PR in draft for a while during the project, though I don't use all socket types, to see if it breaks anything obvious.