Skip to content

Commit

Permalink
Only stop PCAP dump after capture
Browse files Browse the repository at this point in the history
This ensures that all the monitored data is actually exported, avoiding
a possible inconsistency between the data shown on the screen and the
exported PCAP data.
  • Loading branch information
emanuele-f committed Aug 18, 2023
1 parent 6c8abf9 commit 1463e16
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -878,9 +878,7 @@ public static void stopService() {
return;

captureService.mStopping = true;

stopPacketLoop();
captureService.signalServicesTermination();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
captureService.stopForeground(STOP_FOREGROUND_REMOVE);
Expand Down
3 changes: 3 additions & 0 deletions app/src/main/jni/core/capture_libpcap.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ static void process_pcapd_rv(pcapdroid_t *pd, int rv) {
case PCAPD_PCAP_READ_ERROR:
log_f(PD_ERR_PCAP_READ);
break;
case PCAPD_SOCKET_WRITE_ERROR:
// ignore, as it can be caused by PCAPdroid stopping the capture
break;
default:
log_f("pcapd daemon exited with code %d", rv);
}
Expand Down

0 comments on commit 1463e16

Please sign in to comment.