summaryrefslogtreecommitdiff
path: root/cmds/statsd/src/shell/ShellSubscriber.cpp
diff options
context:
space:
mode:
authorYao Chen <yaochen@google.com>2018-10-01 14:49:03 -0700
committerYao Chen <yaochen@google.com>2018-10-01 14:49:03 -0700
commit398dd19f66f66bea150c78425f96122027180aab (patch)
tree14b920a5b357291f430bbf5ef314897b71e24386 /cmds/statsd/src/shell/ShellSubscriber.cpp
parent043a3a713de8864afb04b3fc029bfc1155c334b3 (diff)
Add unit tests for ShellSubscriber and fix a bug
Test: statsd_test Change-Id: Iaf0558ec2a2dc190bedb240da8019868266ec8f5
Diffstat (limited to 'cmds/statsd/src/shell/ShellSubscriber.cpp')
-rw-r--r--cmds/statsd/src/shell/ShellSubscriber.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmds/statsd/src/shell/ShellSubscriber.cpp b/cmds/statsd/src/shell/ShellSubscriber.cpp
index 3cd49d722fea..1306a467e5c4 100644
--- a/cmds/statsd/src/shell/ShellSubscriber.cpp
+++ b/cmds/statsd/src/shell/ShellSubscriber.cpp
@@ -113,12 +113,12 @@ void ShellSubscriber::onLogEvent(const LogEvent& event) {
for (const auto& matcher : mPushedMatchers) {
if (matchesSimple(*mUidMap, matcher, event)) {
+ event.ToProto(mProto);
// First write the payload size.
size_t bufferSize = mProto.size();
write(mOutput, &bufferSize, sizeof(bufferSize));
// Then write the payload.
- event.ToProto(mProto);
mProto.flush(mOutput);
mProto.clear();
break;
@@ -137,4 +137,4 @@ void ShellSubscriber::binderDied(const wp<IBinder>& who) {
} // namespace statsd
} // namespace os
-} // namespace android \ No newline at end of file
+} // namespace android