Only stop PCAP dump after capture

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.
This commit is contained in:
emanuele-f 2023-08-18 21:11:53 +02:00
parent 6c8abf92c5
commit 1463e1656f
2 changed files with 3 additions and 2 deletions

View File

@ -878,9 +878,7 @@ public class CaptureService extends VpnService implements Runnable {
return;
captureService.mStopping = true;
stopPacketLoop();
captureService.signalServicesTermination();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N)
captureService.stopForeground(STOP_FOREGROUND_REMOVE);

View File

@ -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);
}