Добавлен ttl стримов

This commit is contained in:
serega6531
2019-05-24 16:45:16 +03:00
parent 669bcaa873
commit 8699990386
4 changed files with 16 additions and 0 deletions

View File

@@ -76,8 +76,13 @@ public class StreamService {
return false;
}
Optional<Packet> firstIncoming = packets.stream()
.filter(Packet::isIncoming)
.findFirst();
Stream stream = new Stream();
stream.setProtocol(unfinishedStream.getProtocol());
stream.setTtl(firstIncoming.isPresent() ? firstIncoming.get().getTtl() : 0);
stream.setStartTimestamp(packets.get(0).getTimestamp());
stream.setEndTimestamp(packets.get(packets.size() - 1).getTimestamp());
stream.setService(serviceOptional.get());
@@ -183,6 +188,8 @@ public class StreamService {
IOUtils.copy(gzipStream, out);
byte[] newContent = ArrayUtils.addAll(httpHeader, out.toByteArray());
log.debug("Разархивирован gzip: {} -> {} байт", gzipBytes.length, out.size());
return Packet.builder()
.incoming(false)
.timestamp(packets.get(0).getTimestamp())