code: func (s *streamImpl) nextBundleEntry(bb *builder, aggressive bool) bool {
  	s.stateLock.Lock()
  	defer s.stateLock.Unlock()
  
  	// If we're not drained, try and get the next bundle.
  	modified := false
  	if !s.noMoreDataLocked() {
  		err := error(nil)
  		modified, err = s.nextBundleEntryLocked(bb, aggressive)
  		if err != nil {
  			s.setAppendErrorLocked(err)
  		}
  
  		if modified {
  			s.signalDataConsumed()
  		}
  	}
  
  	// If we're drained, populate our terminal state.
  	if s.noMoreDataLocked() {
  		if s.lastLogEntry != nil {
  			bb.setStreamTerminal(&s.c.template, s.lastLogEntry.StreamIndex)
  		}
  		s.setDrained()
  	}
  
  	return modified
  }
docs: // nextBundleEntry generates bundles for this stream. The total bundle data size
  // must not exceed the supplied size.
  //
  // If no bundle entry could be generated given the constraints, nil will be
  // returned.
  //
  // It is possible for some entries to be returned alongside an error.