func (r *Reactor) processDataCh() {
	defer r.dataCh.Close()

	for {
		select {
		case envelope := <-r.dataCh.In:
			if err := r.handleMessage(r.dataCh.ID, envelope); err != nil {
				r.Logger.Error("failed to process message", "ch_id", r.dataCh.ID, "envelope", envelope, "err", err)
				r.dataCh.Error <- p2p.PeerError{
					NodeID: envelope.From,
					Err:    err,
				}
			}

		case <-r.closeCh:
			r.Logger.Debug("stopped listening on DataChannel; closing...")
			return
		}
	}
}
// processDataCh initiates a blocking process where we listen for and handle
// envelopes on the DataChannel. Any error encountered during message
// execution will result in a PeerError being sent on the DataChannel. When
// the reactor is stopped, we will catch the signal and close the p2p Channel
// gracefully.
processDataCh initiates a blocking process where we listen for and handle
envelopes on the DataChannel. Any error encountered during message
execution will result in a PeerError being sent on the DataChannel. When
the reactor is stopped, we will catch the signal and close the p2p Channel
gracefully.
// processDataCh initiates a blocking process where we listen for and handle // envelopes on the DataChannel . Any error encountered during message // execution will result in a PeerError being sent on the DataChannel . When // the reactor is stopped we will catch the signal and close the p2p Channel // gracefully .
func (r *Reactor) processDataCh() {
	defer r.dataCh.Close()
	for {
		select {
		case envelope := <-r.dataCh.In:
			if err := r.handleMessage(r.dataCh.ID, envelope); err != nil {
				r.Logger.Error("failed to process message", "ch_id", r.dataCh.ID, "envelope", envelope, "err", err)
				r.dataCh.Error <- p2p.PeerError{
					NodeID: envelope.From,
					Err:    err,
				}
			}
		case <-r.closeCh:
			r.Logger.Debug("stopped listening on DataChannel; closing...")
			return
		}
	}
}
func ( r * Reactor ) processDataCh ( ) { defer r . dataCh . Close ( ) for { select { case envelope := <- r . dataCh . In : if err := r . handleMessage ( r . dataCh . ID , envelope ) ; err != nil { r . Logger . Error ( " " , " " , r . dataCh . ID , " " , envelope , " " , err ) r . dataCh . Error <- p2p . PeerError { NodeID : envelope . From , Err : err , } } case <- r . closeCh : r . Logger . Debug ( " " ) return } } }
processDataCh initiates a blocking process where we listen for and handle
envelopes on the DataChannel.
processDataCh initiates a blocking process where we listen for and handle envelopes on the DataChannel .