From 2ef16b2ab03815f57cd9aff8e35d24b9533e0ce6 Mon Sep 17 00:00:00 2001 From: eddyem Date: Fri, 22 Apr 2016 17:06:25 +0300 Subject: [PATCH] little fix --- simple_websockets/main.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/simple_websockets/main.c b/simple_websockets/main.c index 0e2a839..05cc89b 100644 --- a/simple_websockets/main.c +++ b/simple_websockets/main.c @@ -85,11 +85,13 @@ static int control_callback(struct lws *wsi, pthread_mutex_lock(&ip_mutex); lws_get_peer_addresses(wsi, lws_get_socket_fd(wsi), client_name, 128, client_ip, 128); - if(!client_IP) + DBG("client %s connected from IP %s", client_name, client_ip); + if(!client_IP){ client_IP = strdup(client_ip); - else if(strcmp(client_IP, client_ip)){ + DBG("new connection"); + }else{ char buf[256]; - snprintf(buf, 255, "Already connected from %s.
Please, disconnect.", client_IP); + snprintf(buf, 255, "Already connected from %s. Please, disconnect.", client_IP); DBG("Already connected\n"); put_message_to_que(buf, dat); snprintf(buf, 255, "Try of connection from %s", client_ip);