MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / setGroupId

Method setGroupId

src/main/java/core/packetproxy/http2/Grpc.java:202–219  ·  view source on GitHub ↗
(Packet packet)

Source from the content-addressed store, hash-verified

200 private Map<Long, Long> groupMap = new HashMap<>();
201
202 public void setGroupId(Packet packet) throws Exception {
203 byte[] data = (packet.getDecodedData().length > 0) ? packet.getDecodedData() : packet.getModifiedData();
204 Http http = Http.create(data);
205 String streamIdStr = http.getFirstHeader("X-PacketProxy-HTTP2-Stream-Id");
206 if (streamIdStr != null && streamIdStr.length() > 0) {
207
208 long streamId = Long.parseLong(streamIdStr);
209 if (groupMap.containsKey(streamId)) {
210
211 packet.setGroup(groupMap.get(streamId));
212 } else {
213
214 long groupId = UniqueID.getInstance().createId();
215 groupMap.put(streamId, groupId);
216 packet.setGroup(groupId);
217 }
218 }
219 }
220}

Callers 2

onClientChunkReceivedMethod · 0.45
onServerChunkReceivedMethod · 0.45

Calls 10

createMethod · 0.95
getFirstHeaderMethod · 0.95
getInstanceMethod · 0.95
getDecodedDataMethod · 0.80
getModifiedDataMethod · 0.80
lengthMethod · 0.80
setGroupMethod · 0.80
createIdMethod · 0.80
getMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected