-
Notifications
You must be signed in to change notification settings - Fork 493
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
ERL: Use IP address instead of IP:port pair #6176
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #6176 +/- ##
==========================================
+ Coverage 51.79% 51.80% +0.01%
==========================================
Files 644 644
Lines 86511 86546 +35
==========================================
+ Hits 44805 44836 +31
- Misses 38834 38840 +6
+ Partials 2872 2870 -2 ☔ View full report in Codecov by Sentry. |
var capguard *util.ErlCapacityGuard | ||
var isCMEnabled bool | ||
var err error | ||
if handler.erl != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
moved the handler.erl != nil
check to processIncomingTxn
eic.m.Unlock() | ||
// if no elements left, call the closer | ||
// use atomic Swap in order to retrieve the closer and call it once | ||
if empty { | ||
// atomic.Value.Swap does not like nil values so use a typed nil | ||
// and cast it to func() in order to compare with nil | ||
if closer := eic.closer.Swap((func())(nil)).(func()); closer != nil { | ||
closer() | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you use both a mutex and an atomic? Could you protect the eic.clients
and the eic.closer
with the eic.m
mutex, so you don't have to do the special handling/casting of the atomic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to reduce the mutex congestion: the close function could be relatively expensive and require own locks.
Summary
Make ERL more strict by distinguishing IP addresses instead of connections.
Idea (basically as suggested in this comment: #6176 (comment))
erlClientMapper
entity that maps sender's addresses to a meta peererlIPClient
.erlIPClient
for senders (connections) with the same address and it's logic not changed.erlIPClient
tracks senders with the same address.erlIPClient
sets ownOnClose
handlers so that when network actually closes a connection, this handler is called.OnClose
called to notify ERL about this client termination.Test Plan
erlIPClient
unit testMemory use remained the same but the test does not have thousands of clients to tell for sure.