libsysutils: Fix some bugs in NetlinkListener and NetlinkEvent
Signed-off-by: San Mehat <san@android.com>
This commit is contained in:
parent
808c89e120
commit
ebfe3db361
|
@ -26,7 +26,9 @@ class NetlinkListener : public SocketListener {
|
|||
public:
|
||||
NetlinkListener(int socket);
|
||||
virtual ~NetlinkListener() {}
|
||||
|
||||
protected:
|
||||
virtual bool onDataAvailable(SocketClient *cli);
|
||||
virtual void onEvent(NetlinkEvent *evt) = 0;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,9 @@ const int NetlinkEvent::NlActionChange = 3;
|
|||
|
||||
NetlinkEvent::NetlinkEvent() {
|
||||
mAction = NlActionUnknown;
|
||||
memset(mParams, 0, sizeof(mParams));
|
||||
mPath = NULL;
|
||||
mSubsystem = NULL;
|
||||
}
|
||||
|
||||
NetlinkEvent::~NetlinkEvent() {
|
||||
|
|
|
@ -32,8 +32,6 @@ NetlinkListener::NetlinkListener(int socket) :
|
|||
bool NetlinkListener::onDataAvailable(SocketClient *cli)
|
||||
{
|
||||
int socket = cli->getSocket();
|
||||
LOGD("NetlinkListener::onDataAvailable()");
|
||||
|
||||
int count;
|
||||
|
||||
if ((count = recv(socket, mBuffer, sizeof(mBuffer), 0)) < 0) {
|
||||
|
@ -47,8 +45,7 @@ bool NetlinkListener::onDataAvailable(SocketClient *cli)
|
|||
goto out;
|
||||
}
|
||||
|
||||
LOGD("Ignoring '%s' netlink event", evt->getSubsystem());
|
||||
|
||||
onEvent(evt);
|
||||
out:
|
||||
delete evt;
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue