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

Method setGroupId

src/main/java/core/packetproxy/http2/Http2.java:141–158  ·  view source on GitHub ↗
(Packet packet)

Source from the content-addressed store, hash-verified

139 private Map<Long, Long> groupMap = new HashMap<>();
140
141 public void setGroupId(Packet packet) throws Exception {
142 byte[] data = (packet.getDecodedData().length > 0) ? packet.getDecodedData() : packet.getModifiedData();
143 Http http = Http.create(data);
144 String streamIdStr = http.getFirstHeader("X-PacketProxy-HTTP2-Stream-Id");
145 if (streamIdStr != null && streamIdStr.length() > 0) {
146
147 long streamId = Long.parseLong(streamIdStr);
148 if (groupMap.containsKey(streamId)) {
149
150 packet.setGroup(groupMap.get(streamId));
151 } else {
152
153 long groupId = UniqueID.getInstance().createId();
154 groupMap.put(streamId, groupId);
155 packet.setGroup(groupId);
156 }
157 }
158 }
159}

Callers

nothing calls this directly

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