Changeset 124:36b6d7d9ba1d in mediastreamer2


Ignore:
Timestamp:
Oct 28, 2008 10:03:49 PM (5 years ago)
Author:
jehan <jehan@…>
Branch:
default
Message:

one more step for fonis ;-)

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@127 3f6dc0c8-ddfe-455d-9043-3cd528dc4637

Location:
p2pproxy/src/org/linphone/p2pproxy/core/sipproxy
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/SipProxyRegistrar.java

    r108 r124  
    2525import java.io.IOException; 
    2626import java.net.InetSocketAddress; 
     27import java.util.Collection; 
    2728import java.util.HashMap; 
    2829import java.util.Map; 
     
    8283   private long mNumberOfUnknownUsersForRegistration; 
    8384   private long mNumberOfUnRegistration; 
     85    
    8486    
    8587   public static class Registration { 
     
    191193      }; 
    192194      mTimer.scheduleAtFixedRate(lPublisherTask, 0, ADV_LIFE_TIME-ADV_LIFE_TIME/10); 
     195      TimerTask lRegistrationTableGC = new TimerTask() { 
     196 
     197                @Override 
     198                public void run() { 
     199                        // copy list 
     200                        Collection<Registration> lCurrentRegistrations = mRegistrationTab.values(); 
     201                        long lCurrentDate = System.currentTimeMillis(); 
     202                        for (Registration lRegistration : lCurrentRegistrations) { 
     203                                if ((lCurrentDate - lRegistration.RegistrationDate - lRegistration.Expiration) > 0) { 
     204                                        if (mLog.isInfoEnabled()) mLog.info("registration entry ["+lRegistration+"] has expired"); 
     205                                        mRegistrationTab.remove(lRegistration.From); 
     206                                } 
     207                        } 
     208                } 
     209           
     210      }; 
     211      mTimer.scheduleAtFixedRate(lRegistrationTableGC, 0, 60000); 
    193212       
    194213   } 
  • p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/JxtaNetworkResources.java

    r60 r124  
    5959         throw new P2pProxyException(e1); 
    6060      } 
    61       mLog.debug("publishing P2pUserRegistration Advertisement ["+mP2pUserRegistrationAdvertisement+"]published expire ["+aLiveTime+"]"); 
     61      mLog.info("publishing P2pUserRegistration Advertisement ["+mP2pUserRegistrationAdvertisement+"]published expire ["+aLiveTime+"]"); 
    6262   }    
    6363    
  • p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/P2pUserRegistrationAdvertisement.java

    r20 r124  
    100100   private String mUserUri; 
    101101   public final static String REGISTRAR_ADDRESS_TAG = "registrar-address"; 
    102    public final static String USER_NAME_TAG = "user-name"; 
     102   public final static String USER_NAME_TAG = "registration-user-name"; 
    103103   private final static String ID_TAG = "ID"; 
    104104   private final static String[] mIndexs = {USER_NAME_TAG}; 
  • p2pproxy/src/org/linphone/p2pproxy/core/sipproxy/superpeers/SuperPeerProxy.java

    r108 r124  
    2020package org.linphone.p2pproxy.core.sipproxy.superpeers; 
    2121 
     22import java.io.IOException; 
     23import java.util.List; 
    2224import java.util.Map; 
    2325 
     
    2729import org.linphone.p2pproxy.api.P2pProxyUserNotFoundException; 
    2830import org.linphone.p2pproxy.core.JxtaNetworkManager; 
     31import org.linphone.p2pproxy.core.P2pProxyAdvertisementNotFoundException; 
    2932import org.linphone.p2pproxy.core.sipproxy.RegistrationHandler; 
    3033import org.linphone.p2pproxy.core.sipproxy.SipProxy; 
     
    6770                                   lNextHope = new SipURL(mRegistrationTab.get(lTo).Contact); 
    6871                           } else { 
    69                                    throw new P2pProxyUserNotFoundException("user ["+lTo+"] not found"); 
     72                                   if (aMessage.isInvite() || aMessage.isCancel()) { 
     73                                           //need to found the right proxy 
     74                                           try { 
     75                                                   List<P2pUserRegistrationAdvertisement> lAdvList = (List<P2pUserRegistrationAdvertisement>) mJxtaNetworkManager.getAdvertisementList(null, P2pUserRegistrationAdvertisement.USER_NAME_TAG,lTo, true); 
     76                                                   lNextHope = new SipURL(lAdvList.get(0).getUserName()); 
     77                                           } catch (Exception e) { 
     78                                                   throw new P2pProxyUserNotFoundException("user ["+lTo+"] not found",e); 
     79                                           }  
     80                                            
     81                                   } 
    7082                           } 
    7183                   } 
Note: See TracChangeset for help on using the changeset viewer.