status-go/vendor/github.com/anacrolix/torrent/tracker/udp/transaction.go

24 lines
383 B
Go

package udp
import "math/rand"
func RandomTransactionId() TransactionId {
return TransactionId(rand.Uint32())
}
type TransactionResponseHandler func(dr DispatchedResponse)
type Transaction struct {
id int32
d *Dispatcher
h TransactionResponseHandler
}
func (t *Transaction) Id() TransactionId {
return t.id
}
func (t *Transaction) End() {
t.d.forgetTransaction(t.id)
}