tractor.dev/toolkit-go@v0.0.0-20241010005851-214d91207d07/duplex/mux/frame/message_windowadjust.go (about)

     1  package frame
     2  
     3  import (
     4  	"bytes"
     5  	"encoding/binary"
     6  	"fmt"
     7  )
     8  
     9  type WindowAdjustMessage struct {
    10  	ChannelID       uint32
    11  	AdditionalBytes uint32
    12  }
    13  
    14  func (msg WindowAdjustMessage) String() string {
    15  	return fmt.Sprintf("{WindowAdjustMessage ChannelID:%d AdditionalBytes:%d}",
    16  		msg.ChannelID, msg.AdditionalBytes)
    17  }
    18  
    19  func (msg WindowAdjustMessage) Channel() (uint32, bool) {
    20  	return msg.ChannelID, true
    21  }
    22  
    23  func (msg WindowAdjustMessage) Bytes() []byte {
    24  	buf := new(bytes.Buffer)
    25  	buf.WriteByte(msgChannelWindowAdjust)
    26  	binary.Write(buf, binary.BigEndian, msg)
    27  	return buf.Bytes()
    28  }