diff options
author | alk3pInjection <webmaster@raspii.tech> | 2022-05-01 20:50:40 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2022-05-01 20:50:40 +0800 |
commit | 5b2cac52ba778c82474b770b8218f12b200abbba (patch) | |
tree | aa6a2935fe22ca8ee764f8d0c5637cc9e540a5f5 /modules/sensors/dynamic_sensor/ConnectionDetector.cpp | |
parent | fff55eaf71d44da7a003bccc4f835351b61efd6e (diff) | |
parent | 05445d8b448ea0349822250fa0c2a6f651289736 (diff) |
Merge tag 'LA.QSSI.12.0.r1-06800-qssi.0' into sugisawa-mr1HEADsugisawa-mr1
"LA.QSSI.12.0.r1-06800-qssi.0"
Change-Id: I3c5a85f5c37b5bba1590d2aa8f67e5b3f01939c8
Diffstat (limited to 'modules/sensors/dynamic_sensor/ConnectionDetector.cpp')
-rw-r--r-- | modules/sensors/dynamic_sensor/ConnectionDetector.cpp | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/modules/sensors/dynamic_sensor/ConnectionDetector.cpp b/modules/sensors/dynamic_sensor/ConnectionDetector.cpp index c51e9125..c009a707 100644 --- a/modules/sensors/dynamic_sensor/ConnectionDetector.cpp +++ b/modules/sensors/dynamic_sensor/ConnectionDetector.cpp @@ -57,8 +57,6 @@ SocketConnectionDetector::SocketConnectionDetector(BaseDynamicSensorDaemon *d, i std::ostringstream s; s << "socket:" << port; mDevice = s.str(); - - run("ddad_socket"); } SocketConnectionDetector::~SocketConnectionDetector() { @@ -67,6 +65,12 @@ SocketConnectionDetector::~SocketConnectionDetector() { } } +void SocketConnectionDetector::Init() { + // run adds a strong reference to this object, so it can't be invoked from + // the constructor. + run("ddad_socket"); +} + int SocketConnectionDetector::waitForConnection() { return ::accept(mListenFd, nullptr, nullptr); } @@ -124,9 +128,6 @@ FileConnectionDetector::FileConnectionDetector ( ALOGE("Cannot setup watch on dir %s", path.c_str()); return; } - - // mLooper != null && mInotifyFd added to looper - run("ddad_file"); } FileConnectionDetector::~FileConnectionDetector() { @@ -138,6 +139,13 @@ FileConnectionDetector::~FileConnectionDetector() { } } +void FileConnectionDetector::Init() { + // mLooper != null && mInotifyFd added to looper + // run adds a strong reference to this object, so it can't be invoked from + // the constructor. + run("ddad_file"); +} + bool FileConnectionDetector::matches(const std::string &name) const { return std::regex_match(name, mRegex); } |