mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-09 10:00:27 +00:00
41 lines
483 B
Go
41 lines
483 B
Go
package torrent
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/monkeyWie/gopeed/protocol/bt/peer"
|
|
"testing"
|
|
)
|
|
|
|
func Test_PeerPool(t *testing.T) {
|
|
pool := newPeerPool()
|
|
pool.put([]peer.Peer{
|
|
{
|
|
IP: 0,
|
|
Port: 0,
|
|
},
|
|
{
|
|
IP: 1,
|
|
Port: 0,
|
|
},
|
|
{
|
|
IP: 2,
|
|
Port: 0,
|
|
},
|
|
{
|
|
IP: 3,
|
|
Port: 0,
|
|
},
|
|
{
|
|
IP: 4,
|
|
Port: 0,
|
|
},
|
|
})
|
|
get := pool.get()
|
|
pool.release(get)
|
|
pool.remove(get)
|
|
for i := 0; i < 5; i++ {
|
|
fmt.Println(pool.get())
|
|
}
|
|
fmt.Println(pool.get())
|
|
}
|