if(CONFIG_DEBUG) writeLog("Existing DA has been down. Reregistering");
logDebug("Existing DA has been down. Reregistering");
    protected DAInfo recvDAAdvert(SLPInputStream sis) throws ServiceLocationException {        DAInfo added = null;        SLPDAAdvMessage msg = new SLPDAAdvMessage();        msg.fromInputStream(sis);                    if(CONFIG_LOG_MSG) writeLog("Received DAAdvert:\n"+msg.toString());                if(msg.getErrorCode() == 0) {            ServiceURL daUrl = msg.getURL();            int daPort = daUrl.getPort();            if(daPort == ServiceURL.NO_PORT) daPort = CONFIG_SLP_PORT;            // if the DA is not allready registered: Add it to the DA list.            synchronized(DAs) {                if(!DAs.containsKey(daUrl.getHost())) {                    if(CONFIG_DEBUG) writeLog("Found a new DA - timestamp: " + msg.getTimestamp());                    // we have a new DA. Add it to the list of DAs (if the DA is not going down)                    if(msg.getTimestamp() != 0) { // 0 means the DA is going down                        if(CONFIG_DEBUG) writeLog("Adding DA to list");                        DAInfo newDA = new DAInfo(daUrl.getHost(), daPort, msg);                        DAs.put(daUrl.getHost(), newDA);                        added = newDA;                    }                }                else {                    // We allready have the DA in our list.                    // Need to check that it has been running continously since                    // the last received advert. If not, we need to refresh the                    // service registrations with this DA.                    // if timestamp == 0, the DA is removed, since a ts of 0 is an                    // indication of the server going down.                    if(CONFIG_DEBUG) writeLog("DA Allready known");                    DAInfo theDA = (DAInfo)DAs.get(daUrl.getHost());                    if(msg.getTimestamp() == 0) {                        // DA going down...                        if(CONFIG_DEBUG) writeLog("DA going down - Removing DA");                        DAs.remove(daUrl.getHost());                    }                    else {                        DAInfo newDA = new DAInfo(daUrl.getHost(), daPort, msg);                        if(msg.getTimestamp() < theDA.getTimestamp()) {                            // The DA has been down. Need to reregister...                            if(CONFIG_DEBUG) writeLog("Existing DA has been down. Reregistering");                            added = newDA;                        }                        // update DAInfo (The attributes may have changed)                        DAs.remove(daUrl.getHost());                        DAs.put(daUrl.getHost(), newDA);                    }                }            }        }            return added;    }