mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-07-16 20:02:47 +00:00
LIBDING-11 use svn update; make iks-reconf; make current
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12478 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
f639c8c642
commit
8f9637d3f4
@ -31,7 +31,7 @@ AC_ARG_WITH(libgnutls-prefix,
|
|||||||
no_libgnutls=yes
|
no_libgnutls=yes
|
||||||
else
|
else
|
||||||
LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
|
LIBGNUTLS_CFLAGS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --cflags`
|
||||||
LIBGNUTLS_LIBS=`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs`
|
LIBGNUTLS_LIBS="`$LIBGNUTLS_CONFIG $libgnutls_config_args --libs` -lpthread"
|
||||||
libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
|
libgnutls_config_version=`$LIBGNUTLS_CONFIG $libgnutls_config_args --version`
|
||||||
|
|
||||||
|
|
||||||
|
@ -4,6 +4,14 @@
|
|||||||
** modify it under the terms of GNU Lesser General Public License.
|
** modify it under the terms of GNU Lesser General Public License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#ifdef HAVE_GNUTLS
|
||||||
|
#define _XOPEN_SOURCE 500
|
||||||
|
#define _GNU_SOURCE
|
||||||
|
#include <pthread.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "iksemel.h"
|
#include "iksemel.h"
|
||||||
|
|
||||||
@ -37,14 +45,17 @@ struct stream_data {
|
|||||||
};
|
};
|
||||||
|
|
||||||
#ifdef HAVE_GNUTLS
|
#ifdef HAVE_GNUTLS
|
||||||
|
static pthread_mutex_t tls_send_mutex;
|
||||||
|
static pthread_mutex_t tls_recv_mutex;
|
||||||
|
|
||||||
static size_t
|
static size_t
|
||||||
tls_push (iksparser *prs, const char *buffer, size_t len)
|
tls_push (iksparser *prs, const char *buffer, size_t len)
|
||||||
{
|
{
|
||||||
struct stream_data *data = iks_user_data (prs);
|
struct stream_data *data = iks_user_data (prs);
|
||||||
int ret;
|
int ret;
|
||||||
|
pthread_mutex_lock(&tls_send_mutex);
|
||||||
ret = data->trans->send (data->sock, buffer, len);
|
ret = data->trans->send (data->sock, buffer, len);
|
||||||
|
pthread_mutex_unlock(&tls_send_mutex);
|
||||||
if (ret) return (size_t) -1;
|
if (ret) return (size_t) -1;
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@ -54,8 +65,9 @@ tls_pull (iksparser *prs, char *buffer, size_t len)
|
|||||||
{
|
{
|
||||||
struct stream_data *data = iks_user_data (prs);
|
struct stream_data *data = iks_user_data (prs);
|
||||||
int ret;
|
int ret;
|
||||||
|
pthread_mutex_lock(&tls_recv_mutex);
|
||||||
ret = data->trans->recv (data->sock, buffer, len, -1);
|
ret = data->trans->recv (data->sock, buffer, len, -1);
|
||||||
|
pthread_mutex_unlock(&tls_recv_mutex);
|
||||||
if (ret == -1) return (size_t) -1;
|
if (ret == -1) return (size_t) -1;
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -584,6 +596,43 @@ iks_is_secure (iksparser *prs)
|
|||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#ifdef HAVE_GNUTLS
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
iks_init(void)
|
||||||
|
{
|
||||||
|
int ok = 0;
|
||||||
|
pthread_mutexattr_t attr;
|
||||||
|
|
||||||
|
if (pthread_mutexattr_init(&attr))
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE))
|
||||||
|
ok = -1;
|
||||||
|
|
||||||
|
if (ok == 0 && pthread_mutex_init(&tls_send_mutex, &attr))
|
||||||
|
ok = -1;
|
||||||
|
|
||||||
|
if (ok == 0 && pthread_mutex_init(&tls_recv_mutex, &attr)) {
|
||||||
|
pthread_mutex_destroy(&tls_send_mutex);
|
||||||
|
ok = -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
pthread_mutexattr_destroy(&attr);
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
int
|
||||||
|
iks_init(void)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
iks_start_tls (iksparser *prs)
|
iks_start_tls (iksparser *prs)
|
||||||
|
@ -2496,8 +2496,9 @@ static ldl_status handle_signalling(ldl_handle_t *handle, ldl_session_t *dlsessi
|
|||||||
from = ffrom;
|
from = ffrom;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strcasecmp(proto, MDL_CHAT_PROTO)) { /* yes no ! on purpose */
|
||||||
switch_core_chat_send(proto, MDL_CHAT_PROTO, from, to, subject, switch_str_nil(msg), NULL, hint);
|
switch_core_chat_send(proto, MDL_CHAT_PROTO, from, to, subject, switch_str_nil(msg), NULL, hint);
|
||||||
|
}
|
||||||
|
|
||||||
switch_safe_free(pproto);
|
switch_safe_free(pproto);
|
||||||
switch_safe_free(ffrom);
|
switch_safe_free(ffrom);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user