Добавлен режим работы VIEW

This commit is contained in:
serega6531
2020-12-28 22:34:23 +03:00
parent 033e18e041
commit 39f7496558
4 changed files with 20 additions and 11 deletions

View File

@@ -1,6 +1,5 @@
package ru.serega6531.packmate.service;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.pcap4j.core.PcapNativeException;
import org.springframework.beans.factory.annotation.Autowired;
@@ -8,6 +7,7 @@ import org.springframework.stereotype.Service;
import ru.serega6531.packmate.model.CtfService;
import ru.serega6531.packmate.model.enums.SubscriptionMessageType;
import ru.serega6531.packmate.model.pojo.SubscriptionMessage;
import ru.serega6531.packmate.pcap.NoOpPcapWorker;
import ru.serega6531.packmate.pcap.PcapWorker;
import java.util.Collection;
@@ -17,7 +17,6 @@ import java.util.stream.Collectors;
@Slf4j
public class PcapService {
@Getter
private boolean started = false;
private final SubscriptionService subscriptionService;
@@ -29,6 +28,10 @@ public class PcapService {
this.worker = worker;
}
public boolean isStarted() {
return started || worker instanceof NoOpPcapWorker;
}
public synchronized void start() throws PcapNativeException {
if(!started) {
started = true;