mreinstein / node-gearman

⚙ Gearman client and worker for node
75 stars 13 forks source link

Incorrect packet: STATUS_RES_UNIQUE parsing? #18

Open darnautovic opened 9 years ago

darnautovic commented 9 years ago

Hi! I ran into an issue regarding packet parsing when using "getJobStatus" function. I found out that I get wrong 'den' value on using "getJobStatus" function. I also discovered that by changing parse pattern from "ssss8" to "sssss" fixes this issue. Was there any particular reason to have last data segment in packet parsed as 8-bit unsigned big-endian?

Here is the code snippet of parse call for STATUS_RES packet type. Changing 'ssss8' to 'sssss' gives me correct den value:

 if packet.type is packet_types.STATUS_RES
result = @_parsePacket packet.inputData, 'ssss8'
result = { handle : result[0], known: result[1], running: result[2], percent_done_num: result[3], percent_done_den: result[4] }
@emit 'STATUS_RES', result
return

Thank you :)

mreinstein commented 9 years ago

@darnautovic sorry for the reply delay. care to send a pull request?