log fixes

This commit is contained in:
mom040267 2014-10-11 18:18:23 +00:00
parent c0442c38c7
commit 2425078425
9 changed files with 26 additions and 14 deletions

View File

@ -10,9 +10,10 @@ Version 4.2.1.2 'Monza':
- Mobility ticket retransmission fixed.
- Move debian package from SVN to GIT.
- Move secondary download area to coturn.net.
- Auota allocation fixed.
- Quota allocation fixed.
- Core dump fixed.
- Bandwidth allocation fixed.
- Logging fixes.
08/14/2014 Oleg Moskalenko <mom040267@gmail.com>
Version 4.1.2.1 'Vitari':

View File

@ -91,7 +91,7 @@ static void redisLibeventReadEvent(int fd, short event, void *arg) {
} while((len<0)&&(errno == EINTR));
if(len<1) {
e->invalid = 1;
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Redis connection broken: e=0x%lx\n", __FUNCTION__, (unsigned long)e);
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Redis connection broken: e=0x%lx\n", __FUNCTION__, ((unsigned long)e));
}
}
if(redis_le_valid(e)) {
@ -213,7 +213,7 @@ void send_message_to_redis(redis_context_handle rch, const char *command, const
if((redisAsyncCommand(ac, NULL, e, rm.format, rm.arg)!=REDIS_OK)) {
e->invalid = 1;
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Redis connection broken: ac=0x%lx, e=0x%x\n", __FUNCTION__,(unsigned long)ac,(unsigned long)e);
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Redis connection broken: ac=0x%lx, e=0x%lx\n", __FUNCTION__,(unsigned long)ac,(unsigned long)e);
}
}
}
@ -372,7 +372,7 @@ static void redis_reconnect(struct redisLibeventEvents *e)
}
if(redis_le_valid(e)) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "Re-connected to redis, async\n", __FUNCTION__);
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "%s: Re-connected to redis, async\n", __FUNCTION__);
}
}

View File

@ -32,6 +32,7 @@
#define __TURN_ULIB__
#if !defined(TURN_LOG_FUNC)
//#define TURN_LOG_FUNC(level, ...) printf (__VA_ARGS__)
#define TURN_LOG_FUNC turn_log_func_default
#endif

View File

@ -52,8 +52,10 @@ static void mongo_logger(mongoc_log_level_t log_level, const char * log_domain,
UNUSED_ARG(log_domain);
UNUSED_ARG(user_data);
TURN_LOG_LEVEL l;
TURN_LOG_LEVEL l = TURN_LOG_LEVEL_INFO;
UNUSED_ARG(l);
switch(log_level) {
case MONGOC_LOG_LEVEL_ERROR:
l = TURN_LOG_LEVEL_ERROR;

View File

@ -268,7 +268,7 @@ static redisContext *get_redis_connection(void) {
if(redisconnection) {
if(redisconnection->err) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot connect to redis, err=%d, flags=0x%x\n", __FUNCTION__,(int)redisconnection->err,(unsigned long)redisconnection->flags);
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Cannot connect to redis, err=%d, flags=0x%lx\n", __FUNCTION__,(int)redisconnection->err,(unsigned long)redisconnection->flags);
redisFree(redisconnection);
pud->connection = NULL;
redisconnection = NULL;

View File

@ -1918,7 +1918,7 @@ int main(int argc, char **argv)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO, "===========Discovering listener addresses: =========\n");
int maddrs = make_local_listeners_list();
if((maddrs<1) || !turn_params.listener.addrs_number) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot configure any meaningful IP listener address\n", __FUNCTION__);
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Cannot configure any meaningful IP listener address\n", __FUNCTION__);
fprintf(stderr,"\n%s\n", Usage);
exit(-1);
}
@ -1953,7 +1953,7 @@ int main(int argc, char **argv)
}
if (!turn_params.relays_number) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "You must specify the relay address(es)\n",
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: You must specify the relay address(es)\n",
__FUNCTION__);
fprintf(stderr,"\n%s\n", Usage);
exit(-1);
@ -2345,7 +2345,7 @@ static void set_ctx(SSL_CTX* ctx, const char *protocol)
EC_KEY *ecdh = EC_KEY_new_by_curve_name(nid);
if (!ecdh) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR,
"%s: ERROR: allocate EC suite\n");
"%s: ERROR: allocate EC suite\n",__FUNCTION__);
} else {
SSL_CTX_set_tmp_ecdh(ctx, ecdh);
EC_KEY_free(ecdh);
@ -2379,10 +2379,10 @@ static void set_ctx(SSL_CTX* ctx, const char *protocol)
}
if(!dh) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: ERROR: cannot allocate DH suite\n");
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: ERROR: cannot allocate DH suite\n",__FUNCTION__);
} else {
if (1 != SSL_CTX_set_tmp_dh (ctx, dh)) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: ERROR: cannot set DH\n");
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: ERROR: cannot set DH\n",__FUNCTION__);
}
DH_free (dh);
}

View File

@ -188,6 +188,8 @@ static void log_socket_event(ioa_socket_handle s, const char *msg, int error) {
if(error)
ll = TURN_LOG_LEVEL_ERROR;
UNUSED_ARG(ll);
{
char sraddr[129]="\0";
char sladdr[129]="\0";
@ -367,7 +369,7 @@ ioa_engine_handle create_ioa_engine(super_memory_t *sm,
}
if (!relays_number || !relay_addrs || !tp) {
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "Cannot create TURN engine\n", __FUNCTION__);
TURN_LOG_FUNC(TURN_LOG_LEVEL_ERROR, "%s: Cannot create TURN engine\n", __FUNCTION__);
return NULL;
} else {
ioa_engine_handle e = (ioa_engine_handle)allocate_super_memory_region(sm, sizeof(ioa_engine));

View File

@ -495,7 +495,7 @@ static int clnet_allocate(int verbose,
current_reservation_token = rtv;
if (verbose)
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO,
"%s: rtv=%llu\n", __FUNCTION__, rtv);
"%s: rtv=%llu\n", __FUNCTION__, (long long unsigned int)rtv);
read_mobility_ticket(clnet_info, &message);
@ -542,7 +542,7 @@ static int clnet_allocate(int verbose,
return -1;
} else {
TURN_LOG_FUNC(TURN_LOG_LEVEL_INFO,
"trying allocate again...\n", err_code);
"trying allocate again %d...\n", err_code);
sleep(1);
reopen_socket = 1;
}

View File

@ -113,6 +113,12 @@ static inline u64bits _ioa_ntoh64(u64bits v)
#if defined(TURN_MEMORY_DEBUG)
#if defined(TURN_LOG_FUNC)
#undef TURN_LOG_FUNC
#endif
#define TURN_LOG_FUNC(level, ...) printf (__VA_ARGS__)
void tm_print_func(void);
void *turn_malloc_func(size_t sz, const char* file, int line);
void *turn_realloc_func(void *ptr, size_t old_sz, size_t new_sz, const char* file, int line);