Change the size limit type to an int64
This commit is contained in:
14
metadaptb.go
14
metadaptb.go
@@ -5,12 +5,10 @@ import "net"
|
||||
import "context"
|
||||
import "git.tebibyte.media/sashakoshka/hopp/tape"
|
||||
|
||||
// TODO: change size limit to be int64
|
||||
|
||||
// B implements METADAPT-B over a multiplexed stream-oriented transport such as
|
||||
// QUIC.
|
||||
type b struct {
|
||||
sizeLimit int
|
||||
sizeLimit int64
|
||||
underlying MultiConn
|
||||
}
|
||||
|
||||
@@ -47,7 +45,7 @@ func (this *b) AcceptTrans() (Trans, error) {
|
||||
return this.newTrans(stream), nil
|
||||
}
|
||||
|
||||
func (this *b) SetSizeLimit(limit int) {
|
||||
func (this *b) SetSizeLimit(limit int64) {
|
||||
this.sizeLimit = limit
|
||||
}
|
||||
|
||||
@@ -59,7 +57,7 @@ func (this *b) newTrans(underlying Stream) *transB {
|
||||
}
|
||||
|
||||
type transB struct {
|
||||
sizeLimit int
|
||||
sizeLimit int64
|
||||
underlying Stream
|
||||
currentData io.Reader
|
||||
}
|
||||
@@ -127,8 +125,8 @@ type Stream interface {
|
||||
ID() int64
|
||||
}
|
||||
|
||||
func encodeMessageB(writer io.Writer, sizeLimit int, method uint16, data []byte) error {
|
||||
if len(data) > sizeLimit {
|
||||
func encodeMessageB(writer io.Writer, sizeLimit int64, method uint16, data []byte) error {
|
||||
if len(data) > int(sizeLimit) {
|
||||
return ErrPayloadTooLarge
|
||||
}
|
||||
buffer := make([]byte, 10 + len(data))
|
||||
@@ -141,7 +139,7 @@ func encodeMessageB(writer io.Writer, sizeLimit int, method uint16, data []byte)
|
||||
|
||||
func decodeMessageB(
|
||||
reader io.Reader,
|
||||
sizeLimit int,
|
||||
sizeLimit int64,
|
||||
) (
|
||||
method uint16,
|
||||
size int64,
|
||||
|
||||
Reference in New Issue
Block a user