IpAddress           dest; Message             copy; Event               evt;  dest=(IpAddress)msg.getDest(); setSourceAddress(msg);  if(log.isTraceEnabled()) log.trace("sending msg to " + msg.getDest() + " (src=" + msg.getSrc() + "), headers are " + msg.getHeaders());     if(loopback && (dest.equals(local_addr) || dest.isMulticastAddress())) { copy=msg.copy();  copy.setSrc(local_addr);  evt=new Event(Event.MSG, copy);   if(observer != null) observer.up(evt, up_queue.size()); if(log.isTraceEnabled()) log.trace("looped back local message " + copy); passUp(evt); if(dest != null && !dest.isMulticastAddress()) return; }  if(use_outgoing_packet_handler) { outgoing_queue.add(msg); return; }  send(msg);
sendUdpMessage(msg, false);
    void sendUdpMessage(Message msg) throws Exception {        IpAddress           dest;        Message             copy;        Event               evt;        dest=(IpAddress)msg.getDest();  // guaranteed to be non-null        setSourceAddress(msg);        if(log.isTraceEnabled())            log.trace("sending msg to " + msg.getDest() + " (src=" + msg.getSrc() + "), headers are " + msg.getHeaders());        // Don't send if destination is local address. Instead, switch dst and src and put in up_queue.        // If multicast message, loopback a copy directly to us (but still multicast). Once we receive this,        // we will discard our own multicast message        if(loopback && (dest.equals(local_addr) || dest.isMulticastAddress())) {            copy=msg.copy();            // copy.removeHeader(name); // we don't remove the header            copy.setSrc(local_addr);            // copy.setDest(dest);            evt=new Event(Event.MSG, copy);            /* Because Protocol.up() is never called by this bottommost layer, we call up() directly in the observer.               This allows e.g. PerfObserver to get the time of reception of a message */            if(observer != null)                observer.up(evt, up_queue.size());            if(log.isTraceEnabled()) log.trace("looped back local message " + copy);            passUp(evt);            if(dest != null && !dest.isMulticastAddress())                return;        }        if(use_outgoing_packet_handler) {            outgoing_queue.add(msg);            return;        }        send(msg);    }