// SendBlockResponse generates deliver response with block message
16585
func (brs *blockResponseSender) SendBlockResponse(block *common.Block) error {
	response := &peer.DeliverResponse{
		Type: &peer.DeliverResponse_Block{Block: block},
	}
	return brs.Send(response)
}
830071
func NewBlockEvent(block *cb.Block, sourceURL string) *connection.Event {
	return connection.NewEvent(
		&pb.DeliverResponse{
			Type: &pb.DeliverResponse_Block{
				Block: block,
			},
		}, sourceURL,
	)
}
1028875
func SendResponse(w http.ResponseWriter, data interface{}, rCode int) {
	rw := responseWriter{
		ResponseWriter: w,
		code:           rCode,
	}

	err := json.NewEncoder(rw).Encode(dOutput{Data: data, Status: rCode})
	if err != nil {
		/*
			In case of encoding error, send "internal server error" after
			logging the actual error.
		*/
		LOGHANDLER.Error(err)
		R500(w, ErrInternalServer)
	}
}
1260513
func SendResponse(w http.ResponseWriter, result interface{}) error {
	response := NewSuccessResponse(result)
	w.Header().Set("Content-Type", "application/json")
	enc := json.NewEncoder(w)
	err := enc.Encode(response)
	return err
}
998862
func (r *Response) SenderAction(action string) error {
	m := SendSenderAction{
		Recipient:    r.to,
		SenderAction: action,
	}
	return r.DispatchMessage(&m)
}
1024241
func (c *MessageStream) SendSSLRequestResponse(r byte) error {
	if c.state != ConnStartup {
		return fmt.Errorf("SendSSLRequestResponse called while the connection is not in the startup phase")
	}
	_, err := c.rw.Write([]byte{r})
	return err
}
848389
func (m *MockNetworkEntity) SendRequest(ctx context.Context, serverID, route string, v interface{}) (*protos.Response, error) {
	ret := m.ctrl.Call(m, "SendRequest", ctx, serverID, route, v)
	ret0, _ := ret[0].(*protos.Response)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
1184744
func (es *eventStream) sendQuery(q *serf.Query) error {
	id := es.client.RegisterQuery(q)

	header := responseHeader{
		Seq:   es.seq,
		Error: "",
	}
	rec := queryEventRecord{
		Event:   q.EventType().String(),
		ID:      id,
		LTime:   q.LTime,
		Name:    q.Name,
		Payload: q.Payload,
	}
	return es.client.Send(&header, &rec)
}
970065
func SendPayload(reqCtx reqContext.Context, payload *common.Payload, orderers []fab.Orderer) (*common.Block, error) {
	if len(orderers) == 0 {
		return nil, errors.New("orderers not set")
	}

	ctx, ok := context.RequestClientContext(reqCtx)
	if !ok {
		return nil, errors.New("failed get client context from reqContext for signPayload")
	}
	envelope, err := signPayload(ctx, payload)
	if err != nil {
		return nil, err
	}

	// Copy aside the ordering service endpoints
	randOrderers := []fab.Orderer{}
	randOrderers = append(randOrderers, orderers...)

	// Iterate them in a random order and try broadcasting 1 by 1
	var errResp error
	for _, i := range rand.Perm(len(randOrderers)) {
		resp, err := sendEnvelope(reqCtx, envelope, randOrderers[i])
		if err != nil {
			errResp = err
		} else {
			return resp, nil
		}
	}
	return nil, errResp
}
924156
func (qs *queryResponseStream) sendResponse(from string, payload []byte) error {
	header := responseHeader{
		Seq:   qs.seq,
		Error: "",
	}
	rec := queryRecord{
		Type:    queryRecordResponse,
		From:    from,
		Payload: payload,
	}
	return qs.client.Send(&header, &rec)
}
39480
func (qs *queryResponseStream) sendDone() error {
	header := responseHeader{
		Seq:   qs.seq,
		Error: "",
	}
	rec := queryRecord{
		Type: queryRecordDone,
	}
	return qs.client.Send(&header, &rec)
}
533312
func (brs *blockResponseSender) SendStatusResponse(status common.Status) error {
	reply := &peer.DeliverResponse{
		Type: &peer.DeliverResponse_Status{Status: status},
	}
	return brs.Send(reply)
}
204504
func (r *BeeResponse) Send(response *restful.Response) {
	var keys []string
	for k := range r.bees {
		keys = append(keys, k)
	}
	sort.Strings(keys)

	for _, k := range keys {
		r.Bees = append(r.Bees, prepareBeeResponse(r.Context, r.bees[k]))
	}

	r.Response.Send(response)
}
544966
func (bot TgBot) SendDocumentWithForceReply(cid int, document string, rmi *int, rm ForceReply) ResultWithMessage {
	var rkm ReplyMarkupInt = rm
	return bot.SendDocument(cid, document, rmi, &rkm)
}
1205389
func (c *MockConnection) Send(sinfo *ab.SeekInfo) error {
	if c.Closed() {
		return errors.New("mock connection is closed")
	}

	switch seek := sinfo.Start.Type.(type) {
	case *ab.SeekPosition_Specified:
		// Deliver all blocks from the given block number
		fromBlock := seek.Specified.Number
		c.Ledger().SendFrom(fromBlock)
	case *ab.SeekPosition_Oldest:
		// Deliver all blocks from the beginning
		c.Ledger().SendFrom(0)
	}

	return nil
}
809976
func (w *worker) sendResponse(ctx *URLContext, visited bool, harvested interface{}, idleDeath bool) {
	// Push harvested urls back to crawler, even if empty (uses the channel communication
	// to decrement reference count of pending URLs)
	if ctx == nil || !isRobotsURL(ctx.url) {
		// If a stop signal has been received, ignore the response, since the push
		// channel may be full and could block indefinitely.
		select {
		case <-w.stop:
			w.logFunc(LogInfo, "ignoring send response, will stop.")
			return
		default:
			// Nothing, just continue...
		}

		// No stop signal, send the response
		res := &workerResponse{
			ctx,
			visited,
			harvested,
			w.host,
			idleDeath,
		}
		w.push <- res
	}
}
655200
func (s *serfQueries) sendKeyResponse(q *Query, resp *nodeKeyResponse) {
	switch q.Name {
	case internalQueryName(listKeysQuery):
		raw, qresp, err := s.keyListResponseWithCorrectSize(q, resp)
		if err != nil {
			s.logger.Printf("[ERR] serf: %v", err)
			return
		}
		if err := q.respondWithMessageAndResponse(raw, qresp); err != nil {
			s.logger.Printf("[ERR] serf: Failed to respond to key query: %v", err)
			return
		}
	default:
		buf, err := encodeMessage(messageKeyResponseType, resp)
		if err != nil {
			s.logger.Printf("[ERR] serf: Failed to encode key response: %v", err)
			return
		}
		if err := q.Respond(buf); err != nil {
			s.logger.Printf("[ERR] serf: Failed to respond to key query: %v", err)
			return
		}
	}
}