-
Notifications
You must be signed in to change notification settings - Fork 271
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
[Link Event Damping] Add tracker to track the selectable timers used by link event damper #1323
base: master
Are you sure you want to change the base?
Conversation
Hi @kcudnik
I am not sure what is the protocol here: do we add fix PR for this or revert the culprit PR #1310 and merge it again with suggested changes? |
SAME ISSUE CAUSES SWSS ERROR HERE: #1310 (comment) please figure out why this is causing build error or revert the change ! |
virtual bool addSelectableToTracker( | ||
_In_ swss::Selectable *selectable, | ||
_In_ SelectableEventHandler *eventHandler); | ||
|
||
// Removes a Selectable from the map. | ||
virtual bool removeSelectableFromTracker( | ||
_In_ swss::Selectable *selectable); | ||
|
||
// Checks if Selectable is present in the tracker map. | ||
virtual bool selectableIsTracked( | ||
_In_ swss::Selectable *selectable); | ||
|
||
// Gets the EventHandler for a Selectable. | ||
virtual SelectableEventHandler *getEventHandlerForSelectable( | ||
_In_ swss::Selectable *selectable); | ||
|
||
private: | ||
|
||
using SelectableFdToEventHandlerMap = std::unordered_map<int, SelectableEventHandler *>; |
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.
use shared_ptr instead of pointers
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.
Doesn't look like w should be using shared_ptr here. Do you use any benefit of using shared_ptr?
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.
yes, benefit is to not lose trakc of pointers and prevent memory leak, please use shared_ptr, as is used in entire syncd project
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.
address comments
change
to
first keyword static requires declaration in cpp file since it's considered a field |
3198dc1
to
38739fb
Compare
link event damper. - Link event damper running on each port will have its own SelectableTimer. This class helps create a mapping of SelectableTimer and object that created the SelectableTimer so that when timer is fired, proper EventHandler object can be invoked. HLD: sonic-net/SONiC#1071
38739fb
to
0fe378f
Compare
Adding @Junchao-Mellanox for review. |
} | ||
|
||
int fd = selectable->getFd(); | ||
if (eventHandler == nullptr) |
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.
move the check before line 20
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.
althoug he wanted to log fd number in error message, anyway please add empty line before if()
HLD: sonic-net/SONiC#1071