mirror of
https://github.com/cloudflare/cloudflared.git
synced 2026-05-14 19:40:41 +00:00
STOR-519: Add db-connect, a SQL over HTTPS server
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
package leakypool
|
||||
|
||||
var pool chan []byte
|
||||
|
||||
func InitBytePool(size int) {
|
||||
pool = make(chan []byte, size)
|
||||
}
|
||||
|
||||
func GetBytes(size, capacity int) (b []byte) {
|
||||
select {
|
||||
case b = <-pool:
|
||||
default:
|
||||
b = make([]byte, size, capacity)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func PutBytes(b []byte) {
|
||||
select {
|
||||
case pool <- b:
|
||||
default:
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user