mirror of https://github.com/ehang-io/nps
parent
a8c0f1653d
commit
0a65975b7e
|
@ -199,7 +199,7 @@ func (Self *window) CloseWindow() {
|
||||||
|
|
||||||
type ReceiveWindow struct {
|
type ReceiveWindow struct {
|
||||||
window
|
window
|
||||||
bufQueue ReceiveWindowQueue
|
bufQueue *ReceiveWindowQueue
|
||||||
element *common.ListElement
|
element *common.ListElement
|
||||||
count int8
|
count int8
|
||||||
bw *writeBandwidth
|
bw *writeBandwidth
|
||||||
|
@ -210,7 +210,7 @@ type ReceiveWindow struct {
|
||||||
|
|
||||||
func (Self *ReceiveWindow) New(mux *Mux) {
|
func (Self *ReceiveWindow) New(mux *Mux) {
|
||||||
// initial a window for receive
|
// initial a window for receive
|
||||||
Self.bufQueue.New()
|
Self.bufQueue = NewReceiveWindowQueue()
|
||||||
Self.element = common.ListElementPool.Get()
|
Self.element = common.ListElementPool.Get()
|
||||||
Self.maxSizeDone = Self.pack(common.MAXIMUM_SEGMENT_SIZE*30, 0, false)
|
Self.maxSizeDone = Self.pack(common.MAXIMUM_SEGMENT_SIZE*30, 0, false)
|
||||||
Self.mux = mux
|
Self.mux = mux
|
||||||
|
|
|
@ -209,10 +209,10 @@ func NewListElement(buf []byte, l uint16, part bool) (element *common.ListElemen
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReceiveWindowQueue struct {
|
type ReceiveWindowQueue struct {
|
||||||
|
lengthWait uint64
|
||||||
chain *bufChain
|
chain *bufChain
|
||||||
stopOp chan struct{}
|
stopOp chan struct{}
|
||||||
readOp chan struct{}
|
readOp chan struct{}
|
||||||
lengthWait uint64 // really strange ???? need put here
|
|
||||||
// https://golang.org/pkg/sync/atomic/#pkg-note-BUG
|
// https://golang.org/pkg/sync/atomic/#pkg-note-BUG
|
||||||
// On non-Linux ARM, the 64-bit functions use instructions unavailable before the ARMv6k core.
|
// On non-Linux ARM, the 64-bit functions use instructions unavailable before the ARMv6k core.
|
||||||
// On ARM, x86-32, and 32-bit MIPS, it is the caller's responsibility
|
// On ARM, x86-32, and 32-bit MIPS, it is the caller's responsibility
|
||||||
|
@ -221,11 +221,14 @@ type ReceiveWindowQueue struct {
|
||||||
timeout time.Time
|
timeout time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Self *ReceiveWindowQueue) New() {
|
func NewReceiveWindowQueue() *ReceiveWindowQueue {
|
||||||
Self.readOp = make(chan struct{})
|
queue := ReceiveWindowQueue{
|
||||||
Self.chain = new(bufChain)
|
chain: new(bufChain),
|
||||||
Self.chain.new(64)
|
stopOp: make(chan struct{}, 2),
|
||||||
Self.stopOp = make(chan struct{}, 2)
|
readOp: make(chan struct{}),
|
||||||
|
}
|
||||||
|
queue.chain.new(64)
|
||||||
|
return &queue
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Self *ReceiveWindowQueue) Push(element *common.ListElement) {
|
func (Self *ReceiveWindowQueue) Push(element *common.ListElement) {
|
||||||
|
|
Loading…
Reference in New Issue