// SendWindowSize indicates an expected call of SendWindowSize
185375
func (mr *MockConnectionFlowControllerMockRecorder) SendWindowSize() *gomock.Call {
	mr.mock.ctrl.T.Helper()
	return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SendWindowSize", reflect.TypeOf((*MockConnectionFlowController)(nil).SendWindowSize))
}
1
func (p *MediaPlaylist) SetWinSize(winsize uint) error {
	if winsize > p.capacity {
		return errors.New("capacity must be greater than winsize or equal")
	}
	p.winsize = winsize
	return nil
}
343295
func MoveWindow(xu *xgbutil.XUtil, win xproto.Window, x, y int) error {
	return MoveresizeWindowExtra(xu, win, x, y, 0, 0, xproto.GravityBitForget,
		2, true, true)
}
851889
func (_class PoolClass) SendWlbConfiguration(sessionID SessionRef, config map[string]string) (_err error) {
	_method := "pool.send_wlb_configuration"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_configArg, _err := convertStringToStringMapToXen(fmt.Sprintf("%s(%s)", _method, "config"), config)
	if _err != nil {
		return
	}
	_, _err =  _class.client.APICall(_method, _sessionIDArg, _configArg)
	return
}
589007
func (s *UDPSession) SetWindowSize(sndwnd, rcvwnd int) {
	s.mu.Lock()
	defer s.mu.Unlock()
	s.kcp.WndSize(sndwnd, rcvwnd)
}
77361
func ResizeWindow(xu *xgbutil.XUtil, win xproto.Window, w, h int) error {
	return MoveresizeWindowExtra(xu, win, 0, 0, w, h, xproto.GravityBitForget,
		2, false, false)
}
669261
func (b *AllocBroadcaster) Send(v *structs.Allocation) error {
	b.mu.Lock()
	defer b.mu.Unlock()
	if b.closed {
		return ErrAllocBroadcasterClosed
	}

	b.logger.Trace("sending updated alloc",
		"client_status", v.ClientStatus,
		"desired_status", v.DesiredStatus,
	)

	// Store last sent alloc for future listeners
	b.last = v

	// Send alloc to already created listeners
	for _, l := range b.listeners {
		select {
		case l <- v:
		case <-l:
			// Pop pending update and replace with new update
			l <- v
		}
	}

	return nil
}
150621
func (s *GetFileOutput) SetFileSize(v int64) *GetFileOutput {
	s.FileSize = &v
	return s
}
1314984
func WindowSize() (w, h int) {
	width, height := Window.GetSize()
	return int(width), int(height)
}
761994
func (c *Browser) SetWindowBoundsWithParams(v *BrowserSetWindowBoundsParams) (*gcdmessage.ChromeResponse, error) {
	return gcdmessage.SendDefaultRequest(c.target, c.target.GetSendCh(), &gcdmessage.ParamRequest{Id: c.target.GetId(), Method: "Browser.setWindowBounds", Params: v})
}
600145
func (h *Client) ViewportSize(viewportSize string) *Client {
	h.viewportSize = viewportSize
	h.viewportSizeSet = true
	return h
}
208019
func (z *MessageExt) Msgsize() (s int) {
	s = 1 + msgp.StringPrefixSize + len(z.Tag) + msgp.ExtensionPrefixSize + z.Time.Len() + msgp.GuessSize(z.Record) + msgp.MapHeaderSize
	if z.Option != nil {
		for za0001, za0002 := range z.Option {
			_ = za0002
			s += msgp.StringPrefixSize + len(za0001) + msgp.StringPrefixSize + len(za0002)
		}
	}
	return
}
689733
func (s *sender) sendData() {
	limit := s.maxPayloadSize
	if s.gso {
		limit = int(s.ep.gso.MaxSize - header.TCPHeaderMaximumSize)
	}
	// Reduce the congestion window to min(IW, cwnd) per RFC 5681, page 10.
	// "A TCP SHOULD set cwnd to no more than RW before beginning
	// transmission if the TCP has not sent data in the interval exceeding
	// the retrasmission timeout."
	if !s.fr.active && time.Now().Sub(s.lastSendTime) > s.rto {
		if s.sndCwnd > InitialCwnd {
			s.sndCwnd = InitialCwnd
		}
	}

	seg := s.writeNext
	end := s.sndUna.Add(s.sndWnd)
	var dataSent bool
	for ; seg != nil && s.outstanding < s.sndCwnd; seg = seg.Next() {
		cwndLimit := (s.sndCwnd - s.outstanding) * s.maxPayloadSize
		if cwndLimit < limit {
			limit = cwndLimit
		}
		// We abuse the flags field to determine if we have already
		// assigned a sequence number to this segment.
		if seg.flags == 0 {
			// Merge segments if allowed.
			if seg.data.Size() != 0 {
				available := int(s.sndNxt.Size(end))
				if available > limit {
					available = limit
				}

				// nextTooBig indicates that the next segment was too
				// large to entirely fit in the current segment. It would
				// be possible to split the next segment and merge the
				// portion that fits, but unexpectedly splitting segments
				// can have user visible side-effects which can break
				// applications. For example, RFC 7766 section 8 says
				// that the length and data of a DNS response should be
				// sent in the same TCP segment to avoid triggering bugs
				// in poorly written DNS implementations.
				var nextTooBig bool

				for seg.Next() != nil && seg.Next().data.Size() != 0 {
					if seg.data.Size()+seg.Next().data.Size() > available {
						nextTooBig = true
						break
					}

					seg.data.Append(seg.Next().data)

					// Consume the segment that we just merged in.
					s.writeList.Remove(seg.Next())
				}

				if !nextTooBig && seg.data.Size() < available {
					// Segment is not full.
					if s.outstanding > 0 && atomic.LoadUint32(&s.ep.delay) != 0 {
						// Nagle's algorithm. From Wikipedia:
						//   Nagle's algorithm works by combining a number of
						//   small outgoing messages and sending them all at
						//   once. Specifically, as long as there is a sent
						//   packet for which the sender has received no
						//   acknowledgment, the sender should keep buffering
						//   its output until it has a full packet's worth of
						//   output, thus allowing output to be sent all at
						//   once.
						break
					}
					if atomic.LoadUint32(&s.ep.cork) != 0 {
						// Hold back the segment until full.
						break
					}
				}
			}

			// Assign flags. We don't do it above so that we can merge
			// additional data if Nagle holds the segment.
			seg.sequenceNumber = s.sndNxt
			seg.flags = header.TCPFlagAck | header.TCPFlagPsh
		}

		var segEnd seqnum.Value
		if seg.data.Size() == 0 {
			if s.writeList.Back() != seg {
				panic("FIN segments must be the final segment in the write list.")
			}
			seg.flags = header.TCPFlagAck | header.TCPFlagFin
			segEnd = seg.sequenceNumber.Add(1)
		} else {
			// We're sending a non-FIN segment.
			if seg.flags&header.TCPFlagFin != 0 {
				panic("Netstack queues FIN segments without data.")
			}

			if !seg.sequenceNumber.LessThan(end) {
				break
			}

			available := int(seg.sequenceNumber.Size(end))
			if available > limit {
				available = limit
			}

			if seg.data.Size() > available {
				// Split this segment up.
				nSeg := seg.clone()
				nSeg.data.TrimFront(available)
				nSeg.sequenceNumber.UpdateForward(seqnum.Size(available))
				s.writeList.InsertAfter(seg, nSeg)
				seg.data.CapLength(available)
			}

			s.outstanding += s.pCount(seg)
			segEnd = seg.sequenceNumber.Add(seqnum.Size(seg.data.Size()))
		}

		if !dataSent {
			dataSent = true
			// We are sending data, so we should stop the keepalive timer to
			// ensure that no keepalives are sent while there is pending data.
			s.ep.disableKeepaliveTimer()
		}

		if !seg.xmitTime.IsZero() {
			s.ep.stack.Stats().TCP.Retransmits.Increment()
			if s.sndCwnd < s.sndSsthresh {
				s.ep.stack.Stats().TCP.SlowStartRetransmits.Increment()
			}
		}

		seg.xmitTime = time.Now()
		s.sendSegment(seg.data, seg.flags, seg.sequenceNumber)

		// Update sndNxt if we actually sent new data (as opposed to
		// retransmitting some previously sent data).
		if s.sndNxt.LessThan(segEnd) {
			s.sndNxt = segEnd
		}
	}

	// Remember the next segment we'll write.
	s.writeNext = seg

	// Enable the timer if we have pending data and it's not enabled yet.
	if !s.resendTimer.enabled() && s.sndUna != s.sndNxt {
		s.resendTimer.enable(s.rto)
	}
	// If we have no more pending data, start the keepalive timer.
	if s.sndUna == s.sndNxt {
		s.ep.resetKeepaliveTimer(false)
	}
}
249765
func WmIconSizeSet(xu *xgbutil.XUtil, win xproto.Window,
	icondim *IconSize) error {

	raw := []uint{
		icondim.MinWidth, icondim.MinHeight,
		icondim.MaxWidth, icondim.MaxHeight,
		icondim.WidthInc, icondim.HeightInc,
	}

	return xprop.ChangeProp32(xu, win, "WM_ICON_SIZE", "WM_ICON_SIZE", raw...)
}
493303
func (t *PosixParser) GetWinSize() *WinSize {
	ws := &ioctlWinsize{}
	retCode, _, errno := syscall.Syscall(
		syscall.SYS_IOCTL,
		uintptr(t.fd),
		uintptr(syscall.TIOCGWINSZ),
		uintptr(unsafe.Pointer(ws)))

	if int(retCode) == -1 {
		panic(errno)
	}
	return &WinSize{
		Row: ws.Row,
		Col: ws.Col,
	}
}
645588
func (s *SessionRegistry) NotifyWinChange(params rsession.TerminalParams, ctx *ServerContext) error {
	if ctx.session == nil {
		s.log.Debugf("Unable to update window size, no session found in context.")
		return nil
	}
	sid := ctx.session.id

	// Build the resize event.
	resizeEvent := events.EventFields{
		events.EventType:      events.ResizeEvent,
		events.EventNamespace: s.srv.GetNamespace(),
		events.SessionEventID: sid,
		events.EventLogin:     ctx.Identity.Login,
		events.EventUser:      ctx.Identity.TeleportUser,
		events.TerminalSize:   params.Serialize(),
	}

	// Report the updated window size to the event log (this is so the sessions
	// can be replayed correctly).
	ctx.session.recorder.GetAuditLog().EmitAuditEvent(events.TerminalResize, resizeEvent)

	// Update the size of the server side PTY.
	err := ctx.session.term.SetWinSize(params)
	if err != nil {
		return trace.Wrap(err)
	}

	// If sessions are being recorded at the proxy, sessions can not be shared.
	// In that situation, PTY size information does not need to be propagated
	// back to all clients and we can return right away.
	if ctx.ClusterConfig.GetSessionRecording() == services.RecordAtProxy {
		return nil
	}

	// Notify all members of the party (except originator) that the size of the
	// window has changed so the client can update it's own local PTY. Note that
	// OpenSSH clients will ignore this and not update their own local PTY.
	for _, p := range s.getParties(ctx.session) {
		// Don't send the window change notification back to the originator.
		if p.ctx.ID() == ctx.ID() {
			continue
		}

		eventPayload, err := json.Marshal(resizeEvent)
		if err != nil {
			s.log.Warnf("Unable to marshal resize event for %v: %v.", p.sconn.RemoteAddr(), err)
			continue
		}

		// Send the message as a global request.
		_, _, err = p.sconn.SendRequest(teleport.SessionEvent, false, eventPayload)
		if err != nil {
			s.log.Warnf("Unable to resize event to %v: %v.", p.sconn.RemoteAddr(), err)
			continue
		}
		s.log.Debugf("Sent resize event %v to %v.", params, p.sconn.RemoteAddr())
	}

	return nil
}
1172900
func GetSize() (ws Size, err error) {
	var wsz *unix.Winsize
	wsz, err = unix.IoctlGetWinsize(syscall.Stdout, TIOCGWINSZ)

	if err != nil {
		ws = Size{80, 25, 0, 0}
	} else {
		ws = Size{wsz.Row, wsz.Col, wsz.Xpixel, wsz.Ypixel}
	}
	return ws, err
}