]> sjero.net Git - linphone/blobdiff - coreapi/TunnelManager.cc
- do not register outside of tunnel when tunnel is activated but not yet connected.
[linphone] / coreapi / TunnelManager.cc
index 4828bf114fbfc1b474ddaa09ba27203bebda6a8f..409f9c42a83635c41ba6ff2890b7166aae46d9f6 100644 (file)
@@ -102,6 +102,10 @@ int TunnelManager::eXosipSelect(int max_fds, fd_set *s1, fd_set *s2, fd_set *s3,
 
 
 void TunnelManager::addServer(const char *ip, int port,unsigned int udpMirrorPort,unsigned int delay) {
+       if (ip == NULL) {
+               ip = "";
+               ms_warning("Adding tunnel server with empty ip, it will not work!");
+       }
        addServer(ip,port);
        mUdpMirrorClients.push_back(UdpMirrorClient(ServerAddr(ip,udpMirrorPort),delay));
 }
@@ -185,7 +189,7 @@ bool TunnelManager::isStarted() {
 }
 
 bool TunnelManager::isReady() const {
-       return mTunnelClient && mTunnelClient->isReady();
+       return mTunnelClient && mTunnelClient->isReady() && mReady;
 }
 
 int TunnelManager::customSendto(struct _RtpTransport *t, mblk_t *msg , int flags, const struct sockaddr *to, socklen_t tolen){
@@ -210,6 +214,7 @@ TunnelManager::TunnelManager(LinphoneCore* lc) :TunnelClientController()
 ,mEnabled(false)
 ,mTunnelClient(NULL)
 ,mAutoDetectStarted(false)
+,mReady(false)
 ,mHttpProxyPort(0){
 
        mExosipTransport.data=this;
@@ -267,6 +272,7 @@ void TunnelManager::processTunnelEvent(const Event &ev){
                if (lProxy) {
                        linphone_proxy_config_done(lProxy);
                }
+               mReady=true;
        }else if (mEnabled && !mTunnelClient->isReady()){
                /* we got disconnected from the tunnel */
                if (lProxy && linphone_proxy_config_is_registered(lProxy)) {
@@ -274,6 +280,7 @@ void TunnelManager::processTunnelEvent(const Event &ev){
                        linphone_proxy_config_edit(lProxy);
                        linphone_core_iterate(mCore);
                }
+               mReady=false;
        }
 }
 
@@ -313,7 +320,7 @@ void TunnelManager::enable(bool isEnable) {
                
                mEnabled=false;
                stopClient();
-               
+               mReady=false;
                linphone_core_set_rtp_transport_factories(mCore,NULL);
 
                eXosip_transport_hook_register(NULL);