mirror of
https://github.com/coturn/coturn.git
synced 2025-05-14 09:36:49 +08:00
peer_input_handler fixes
This commit is contained in:
parent
fe673e62ca
commit
6bd501ac9d
@ -1,3 +1,7 @@
|
||||
11/29/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
Version 4.3.1.3 'Tolomei':
|
||||
- Reliability fixes (Issue 141 from rfc5766-turn-server).
|
||||
|
||||
11/23/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
Version 4.3.1.2 'Tolomei':
|
||||
- Debian package fixes.
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
# Common settings script.
|
||||
|
||||
TURNVERSION=4.3.1.2
|
||||
TURNVERSION=4.3.1.3
|
||||
BUILDDIR=~/rpmbuild
|
||||
ARCH=`uname -p`
|
||||
TURNSERVER_SVN_URL=http://coturn.googlecode.com/svn
|
||||
|
@ -1,5 +1,5 @@
|
||||
Name: turnserver
|
||||
Version: 4.3.1.2
|
||||
Version: 4.3.1.3
|
||||
Release: 0%{dist}
|
||||
Summary: Coturn TURN Server
|
||||
|
||||
@ -294,6 +294,8 @@ fi
|
||||
%{_includedir}/turn/client/TurnMsgLib.h
|
||||
|
||||
%changelog
|
||||
* Sat Nov 29 2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
- Sync to 4.3.1.3
|
||||
* Mon Nov 23 2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
- Sync to 4.3.1.2
|
||||
* Mon Nov 22 2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||
|
@ -2063,15 +2063,17 @@ int main(int argc, char **argv)
|
||||
|
||||
#if defined(OPENSSL_THREADS)
|
||||
|
||||
static pthread_mutex_t* mutex_buf = NULL;
|
||||
static pthread_mutex_t** mutex_buf = NULL;
|
||||
|
||||
static void locking_function(int mode, int n, const char *file, int line) {
|
||||
UNUSED_ARG(file);
|
||||
UNUSED_ARG(line);
|
||||
if (mode & CRYPTO_LOCK)
|
||||
pthread_mutex_lock(&mutex_buf[n]);
|
||||
else
|
||||
pthread_mutex_unlock(&mutex_buf[n]);
|
||||
if(mutex_buf && (n < CRYPTO_num_locks()) && mutex_buf[n]) {
|
||||
if (mode & CRYPTO_LOCK)
|
||||
pthread_mutex_lock(mutex_buf[n]);
|
||||
else
|
||||
pthread_mutex_unlock(mutex_buf[n]);
|
||||
}
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
|
||||
@ -2094,12 +2096,13 @@ static int THREAD_setup(void) {
|
||||
|
||||
int i;
|
||||
|
||||
mutex_buf = (pthread_mutex_t*) turn_malloc(CRYPTO_num_locks()
|
||||
* sizeof(pthread_mutex_t));
|
||||
mutex_buf = (pthread_mutex_t**) turn_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t*));
|
||||
if (!mutex_buf)
|
||||
return 0;
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++)
|
||||
pthread_mutex_init(&mutex_buf[i], NULL);
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++) {
|
||||
mutex_buf[i] = (pthread_mutex_t*) turn_malloc(sizeof(pthread_mutex_t));
|
||||
pthread_mutex_init(mutex_buf[i], NULL);
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x10000000L
|
||||
CRYPTO_THREADID_set_callback(id_function);
|
||||
@ -2130,9 +2133,14 @@ int THREAD_cleanup(void) {
|
||||
#endif
|
||||
|
||||
CRYPTO_set_locking_callback(NULL);
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++)
|
||||
pthread_mutex_destroy(&mutex_buf[i]);
|
||||
turn_free(mutex_buf,sizeof(pthread_mutex_t));
|
||||
for (i = 0; i < CRYPTO_num_locks(); i++) {
|
||||
if(mutex_buf[i]) {
|
||||
pthread_mutex_destroy(mutex_buf[i]);
|
||||
turn_free(mutex_buf[i],sizeof(pthread_mutex_t));
|
||||
mutex_buf[i] = NULL;
|
||||
}
|
||||
}
|
||||
turn_free(mutex_buf,CRYPTO_num_locks() * sizeof(pthread_mutex_t*));
|
||||
mutex_buf = NULL;
|
||||
|
||||
#endif
|
||||
|
@ -31,7 +31,7 @@
|
||||
#ifndef __IOADEFS__
|
||||
#define __IOADEFS__
|
||||
|
||||
#define TURN_SERVER_VERSION "4.3.1.2"
|
||||
#define TURN_SERVER_VERSION "4.3.1.3"
|
||||
#define TURN_SERVER_VERSION_NAME "Tolomei"
|
||||
#define TURN_SOFTWARE "Coturn-" TURN_SERVER_VERSION " '" TURN_SERVER_VERSION_NAME "'"
|
||||
|
||||
|
@ -4623,24 +4623,23 @@ int open_client_connection_session(turn_turnserver* server,
|
||||
static void peer_input_handler(ioa_socket_handle s, int event_type,
|
||||
ioa_net_data *in_buffer, void *arg, int can_resume) {
|
||||
|
||||
if (!(event_type & IOA_EV_READ) || !arg)
|
||||
return;
|
||||
if (!(event_type & IOA_EV_READ) || !arg) return;
|
||||
|
||||
if(in_buffer->recv_ttl==0)
|
||||
return;
|
||||
if(in_buffer->recv_ttl==0) return;
|
||||
|
||||
UNUSED_ARG(s);
|
||||
UNUSED_ARG(can_resume);
|
||||
|
||||
if(ioa_socket_tobeclosed(s)) return;
|
||||
|
||||
ts_ur_super_session* ss = (ts_ur_super_session*) arg;
|
||||
|
||||
if(!ss || !s) return;
|
||||
if(!ss) return;
|
||||
|
||||
if(ss->to_be_closed) return;
|
||||
|
||||
turn_turnserver *server = (turn_turnserver*) (ss->server);
|
||||
|
||||
if (!server) {
|
||||
return;
|
||||
}
|
||||
if (!server) return;
|
||||
|
||||
relay_endpoint_session* elem = get_relay_session_ss(ss, get_ioa_socket_address_family(s));
|
||||
if (elem->s == NULL) {
|
||||
@ -4654,8 +4653,6 @@ static void peer_input_handler(ioa_socket_handle s, int event_type,
|
||||
|
||||
if (ilen >= 0) {
|
||||
|
||||
size_t len = (size_t)(ilen);
|
||||
|
||||
allocation* a = get_allocation_ss(ss);
|
||||
if (is_allocation_valid(a)) {
|
||||
|
||||
@ -4672,6 +4669,9 @@ static void peer_input_handler(ioa_socket_handle s, int event_type,
|
||||
}
|
||||
|
||||
if (chnum) {
|
||||
|
||||
size_t len = (size_t)(ilen);
|
||||
|
||||
nbh = in_buffer->nbh;
|
||||
|
||||
ioa_network_buffer_add_offset_size(nbh,
|
||||
@ -4693,6 +4693,9 @@ static void peer_input_handler(ioa_socket_handle s, int event_type,
|
||||
(int) (chnum));
|
||||
}
|
||||
} else {
|
||||
|
||||
size_t len = 0;
|
||||
|
||||
nbh = ioa_network_buffer_allocate(server->e);
|
||||
stun_init_indication_str(STUN_METHOD_DATA, ioa_network_buffer_data(nbh), &len);
|
||||
stun_attr_add_str(ioa_network_buffer_data(nbh), &len, STUN_ATTRIBUTE_DATA,
|
||||
|
Loading…
x
Reference in New Issue
Block a user