mirror of
https://github.com/xtaci/kcp-go.git
synced 2024-04-21 12:32:15 +00:00
use unix.Milli
This commit is contained in:
@@ -333,7 +333,7 @@ func (enc *fecEncoder) encode(b []byte) (ps [][]byte) {
|
||||
sz := len(b)
|
||||
enc.shardCache[enc.shardCount] = enc.shardCache[enc.shardCount][:sz]
|
||||
copy(enc.shardCache[enc.shardCount][enc.payloadOffset:], b[enc.payloadOffset:])
|
||||
enc.tsCache[enc.shardCount] = time.Now().UnixNano() / int64(time.Millisecond)
|
||||
enc.tsCache[enc.shardCount] = time.Now().UnixMilli()
|
||||
enc.shardCount++
|
||||
|
||||
// track max datashard length
|
||||
|
||||
@@ -154,9 +154,9 @@ func newUDPSession(conv uint32, dataShards, parityShards int, l *Listener, conn
|
||||
// FEC codec initialization
|
||||
sess.fecDecoder = newFECDecoder(dataShards, parityShards)
|
||||
if sess.block != nil {
|
||||
sess.fecEncoder = newFECEncoder(dataShards, parityShards, cryptHeaderSize, IKCP_RTO_MIN)
|
||||
sess.fecEncoder = newFECEncoder(dataShards, parityShards, cryptHeaderSize, IKCP_RTO_DEF)
|
||||
} else {
|
||||
sess.fecEncoder = newFECEncoder(dataShards, parityShards, 0, IKCP_RTO_MIN)
|
||||
sess.fecEncoder = newFECEncoder(dataShards, parityShards, 0, IKCP_RTO_DEF)
|
||||
}
|
||||
|
||||
// calculate additional header size introduced by FEC and encryption
|
||||
|
||||
Reference in New Issue
Block a user