Skip to content

Commit b3c4e65

Browse files
committed
uses basic chescks
1 parent 64ff6a8 commit b3c4e65

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/index.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,8 @@ const httpServer = http.createServer(function (req, res) {
229229
if (decoded.protos && Array.isArray(decoded.protos)) {
230230
for (const rawProto of decoded.protos) {
231231
const identifier = rawProto.trainer_id || "unknown";
232-
const method = rawProto.method?.valueOf() || 0;
232+
// const level = rawProto.trainer_level || 0;
233+
const method = rawProto.method!;
233234
const requestBytes = rawProto.request;
234235
const responseBytes = rawProto.proto;
235236

@@ -268,11 +269,12 @@ const httpServer = http.createServer(function (req, res) {
268269
if (decoded.push_gateway_protos && Array.isArray(decoded.push_gateway_protos)) {
269270
for (const pushProto of decoded.push_gateway_protos) {
270271
const identifier = pushProto.trainer_id || "unknown";
271-
const method = pushProto.method?.valueOf() || 0;
272+
// const level = pushProto.trainer_level || 0;
273+
const method = pushProto.method!;
272274
const responseBytes = pushProto.proto;
273275

274276
// Decode response
275-
if (responseBytes && responseBytes.length > 0) {
277+
if (responseBytes && responseBytes.length > 0 && method !== 0) {
276278
const parsedResponseData = decodeProtoFromBytes(method, responseBytes, "response");
277279
if (typeof parsedResponseData !== "string") {
278280
parsedResponseData.identifier = identifier;

0 commit comments

Comments
 (0)