Open FTwOoO opened 8 years ago
After reading the source code of gohop, i have 2 questions about the implementation that i don't understand, could u explain it?
What does the 'rate' mean in hopPacketBuffer:Pop(), to delay the pop operation? What does the algorithm means?
func (hb *hopPacketBuffer) Pop() *HopPacket { <-hb.newPack r := int(hb.rate & 0x10) if hb.buf.count < 8+r { time.Sleep(time.Duration(r*20+50) * time.Microsecond) hb.rate = hb.rate >> 1 } p := hb.buf.Pop().(*HopPacket) return p }
For the PKCS5UnPadding method, if there's no padding, this method will still get the last byte as padding length, is it wrong ?
func PKCS5UnPadding(origData []byte) []byte { length := len(origData) unpadding := int(origData[length-1]) return origData[:(length - unpadding)] }
After reading the source code of gohop, i have 2 questions about the implementation that i don't understand, could u explain it?
What does the 'rate' mean in hopPacketBuffer:Pop(), to delay the pop operation? What does the algorithm means?
For the PKCS5UnPadding method, if there's no padding, this method will still get the last byte as padding length, is it wrong ?