func (r *Relayer) handleNonCallReq(f *Frame) error {
	frameType := frameTypeFor(f)
	finished := finishesCall(f)

	// If we read a request frame, we need to use the outbound map to decide
	// the destination. Otherwise, we use the inbound map.
	items := r.outbound
	if frameType == responseFrame {
		items = r.inbound
	}

	item, ok := items.Get(f.Header.ID)
	if !ok {
		return errUnknownID
	}
	if item.tomb {
		// Call timed out, ignore this frame. (We've already handled stats.)
		// TODO: metrics for late-arriving frames.
		return nil
	}

	originalID := f.Header.ID
	f.Header.ID = item.remapID

	sent, failure := item.destination.Receive(f, frameType)
	if !sent {
		r.failRelayItem(items, originalID, failure)
		return nil
	}

	if finished {
		r.finishRelayItem(items, originalID)
	}
	return nil
}
func (r *Relayer) handleNonCallReq(f *Frame) error {
	frameType := frameTypeFor(f)
	finished := finishesCall(f)

	
	
	items := r.outbound
	if frameType == responseFrame {
		items = r.inbound
	}

	item, ok := items.Get(f.Header.ID)
	if !ok {
		return errUnknownID
	}
	if item.tomb {
		
		
		return nil
	}

	originalID := f.Header.ID
	f.Header.ID = item.remapID

	sent, failure := item.destination.Receive(f, frameType)
	if !sent {
		r.failRelayItem(items, originalID, failure)
		return nil
	}

	if finished {
		r.finishRelayItem(items, originalID)
	}
	return nil
}
func ( r * Relayer ) handleNonCallReq ( f * Frame ) error { frameType := frameTypeFor ( f ) finished := finishesCall ( f ) // If we read a request frame, we need to use the outbound map to decide // the destination. Otherwise, we use the inbound map. items := r . outbound if frameType == responseFrame { items = r . inbound } item , ok := items . Get ( f . Header . ID ) if ! ok { return errUnknownID } if item . tomb { // Call timed out, ignore this frame. (We've already handled stats.) // TODO: metrics for late-arriving frames. return nil } originalID := f . Header . ID f . Header . ID = item . remapID sent , failure := item . destination . Receive ( f , frameType ) if ! sent { r . failRelayItem ( items , originalID , failure ) return nil } if finished { r . finishRelayItem ( items , originalID ) } return nil }
// Handle all frames except messageTypeCallReq.
Handle all frames except messageTypeCallReq .