Commit fd98c1e0 authored by Simon Morlat's avatar Simon Morlat

- do not register outside of tunnel when tunnel is activated but not yet connected.

- move TUNNEL_ENABLED to config.h, which avoids recompilation issues with -D flags.
parent 75e6db7a
......@@ -656,9 +656,7 @@ AC_ARG_ENABLE(tunnel,
AM_CONDITIONAL(BUILD_TUNNEL, test x$enable_tunnel = xtrue)
if test x$enable_tunnel = xtrue; then
PKG_CHECK_MODULES(TUNNEL, tunnel >= 0.3.3)
TUNNEL_CFLAGS+="-DTUNNEL_ENABLED"
AC_SUBST(TUNNEL_CFLAGS)
AC_SUBST(TUNNEL_LIBS)
AC_DEFINE(TUNNEL_ENABLED,1,[Tells tunnel extension is built-in])
fi
AC_ARG_ENABLE(msg-storage,
......
......@@ -189,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){
......@@ -214,6 +214,7 @@ TunnelManager::TunnelManager(LinphoneCore* lc) :TunnelClientController()
,mEnabled(false)
,mTunnelClient(NULL)
,mAutoDetectStarted(false)
,mReady(false)
,mHttpProxyPort(0){
mExosipTransport.data=this;
......@@ -271,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)) {
......@@ -278,6 +280,7 @@ void TunnelManager::processTunnelEvent(const Event &ev){
linphone_proxy_config_edit(lProxy);
linphone_core_iterate(mCore);
}
mReady=false;
}
}
......@@ -317,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);
......
......@@ -129,6 +129,7 @@ class UdpMirrorClient;
*/
LinphoneCore *getLinphoneCore();
virtual void setHttpProxy(const char *host,int port, const char *username, const char *passwd);
virtual bool isReady() const;
private:
enum EventType{
UdpMirrorClientEvent,
......@@ -143,7 +144,6 @@ class UdpMirrorClient;
};
typedef std::list<UdpMirrorClient> UdpMirrorClientList;
virtual bool isStarted();
virtual bool isReady() const;
void onIterate();
static int customSendto(struct _RtpTransport *t, mblk_t *msg , int flags, const struct sockaddr *to, socklen_t tolen);
static int customRecvfrom(struct _RtpTransport *t, mblk_t *msg, int flags, struct sockaddr *from, socklen_t *fromlen);
......@@ -173,6 +173,7 @@ class UdpMirrorClient;
Mutex mMutex;
static Mutex sMutex;
bool mAutoDetectStarted;
bool mReady;
LinphoneRtpTransportFactories mTransportFactories;
std::string mHttpUserName;
std::string mHttpPasswd;
......
......@@ -233,6 +233,10 @@ bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel){
return bcTunnel(tunnel)->isEnabled();
}
bool_t linphone_tunnel_connected(LinphoneTunnel *tunnel){
return bcTunnel(tunnel)->isReady();
}
static OrtpLogFunc tunnelOrtpLogHandler=NULL;
/*
......
......@@ -165,6 +165,12 @@ void linphone_tunnel_enable(LinphoneTunnel *tunnel, bool_t enabled);
**/
bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel);
/**
* @param tunnel object
* Returns a boolean indicating whether tunnel is connected successfully.
**/
bool_t linphone_tunnel_connected(LinphoneTunnel *tunnel);
/**
* @param tunnel object
* Forces reconnection to the tunnel server.
......
......@@ -59,6 +59,10 @@ bool_t linphone_tunnel_enabled(LinphoneTunnel *tunnel){
return FALSE;
}
bool_t linphone_tunnel_connected(LinphoneTunnel *tunnel){
return FALSE;
}
void linphone_tunnel_enable_logs_with_handler(LinphoneTunnel *tunnel, bool_t enabled, OrtpLogFunc logHandler){
}
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment