WARNING: CRYPTO DISABLED while speeding up stream writeMsg

This commit is contained in:
Arceliar 2019-08-04 14:18:59 -05:00
parent 1e6a6d2160
commit f52955ee0f
5 changed files with 28 additions and 13 deletions

View file

@ -34,6 +34,15 @@ func PutBytes(bs []byte) {
byteStore.Put(bs)
}
// Gets a slice of the appropriate length, reusing existing slice capacity when possible
func ResizeBytes(bs []byte, length int) []byte {
if cap(bs) >= length {
return bs[:length]
} else {
return make([]byte, length)
}
}
// This is a workaround to go's broken timer implementation
func TimerStop(t *time.Timer) bool {
stopped := t.Stop()