From c22b0ac92eec8a22026113858501da9fffbc11c7 Mon Sep 17 00:00:00 2001
From: Dmitriy Gerasimov <dm@cifercom.com>
Date: Fri, 10 Aug 2018 11:52:58 +0700
Subject: [PATCH] [+] av and chat channels [*] log output renames [*] lib
 versions update

---
 .gitmodules            | 16 +++++++++++-----
 libdap                 |  2 +-
 libdap-server          |  2 +-
 libdap-stream          |  2 +-
 libdap-stream-ch-av    |  1 +
 libdap-stream-ch-chat  |  1 +
 libdap-stream-ch-vpn   |  2 +-
 sources/node_manager.c | 36 +++++++++++++++++++++---------------
 8 files changed, 38 insertions(+), 24 deletions(-)
 create mode 160000 libdap-stream-ch-av
 create mode 160000 libdap-stream-ch-chat

diff --git a/.gitmodules b/.gitmodules
index 3ae2db64..168ab2e2 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,15 +1,21 @@
 [submodule "libdap"]
 	path = libdap
-	url = https://github.com/demlabsinc/libdap.git
+	url = https://github.com/kelvinblockchain/libdap.git
 [submodule "libdap-server"]
 	path = libdap-server
-	url = https://github.com/demlabsinc/libdap-server.git
+	url = https://github.com/kelvinblockchain/libdap-server.git
 [submodule "libdap-chain"]
 	path = libdap-chain
-	url = https://github.com/demlabsinc/libdap-chain.git
+	url = https://github.com/kelvinblockchain/libdap-chain.git
 [submodule "libdap-stream"]
 	path = libdap-stream
-	url = https://github.com/demlabsinc/libdap-stream.git
+	url = https://github.com/kelvinblockchain/libdap-stream.git
 [submodule "libdap-stream-ch-vpn"]
 	path = libdap-stream-ch-vpn
-	url = https://github.com/demlabsinc/libdap-stream-ch-vpn.git
+	url = https://github.com/kelvinblockchain/libdap-stream-ch-vpn.git
+[submodule "libdap-stream-ch-av"]
+	path = libdap-stream-ch-av
+	url = https://github.com/kelvinblockchain/libdap-stream-ch-av
+[submodule "libdap-stream-ch-chat"]
+	path = libdap-stream-ch-chat
+	url = https://github.com/kelvinblockchain/libdap-stream-ch-chat
diff --git a/libdap b/libdap
index d7743678..737931d0 160000
--- a/libdap
+++ b/libdap
@@ -1 +1 @@
-Subproject commit d77436785654ce4c10d7b5cdbd22fff3e03665e4
+Subproject commit 737931d0cc1080502a564f7a0fe00dfb23f84087
diff --git a/libdap-server b/libdap-server
index 813167b5..f4d20ce6 160000
--- a/libdap-server
+++ b/libdap-server
@@ -1 +1 @@
-Subproject commit 813167b563e88873dd40bc27b79863586612269f
+Subproject commit f4d20ce6161fc705abe4b526c7e91b8f6564131f
diff --git a/libdap-stream b/libdap-stream
index f8b3d76a..ef24af6c 160000
--- a/libdap-stream
+++ b/libdap-stream
@@ -1 +1 @@
-Subproject commit f8b3d76ac722aeb31c4af3b99217baa9cdfb2486
+Subproject commit ef24af6c87d6141ebb919a62f8b1fd461a373f60
diff --git a/libdap-stream-ch-av b/libdap-stream-ch-av
new file mode 160000
index 00000000..f5e9c292
--- /dev/null
+++ b/libdap-stream-ch-av
@@ -0,0 +1 @@
+Subproject commit f5e9c2928c943ea4abf4e9107c9381366e1255e0
diff --git a/libdap-stream-ch-chat b/libdap-stream-ch-chat
new file mode 160000
index 00000000..dede25eb
--- /dev/null
+++ b/libdap-stream-ch-chat
@@ -0,0 +1 @@
+Subproject commit dede25eb4c35c5ba50bddddea237eb1fc2e0ce8e
diff --git a/libdap-stream-ch-vpn b/libdap-stream-ch-vpn
index 61d26548..c864bcf8 160000
--- a/libdap-stream-ch-vpn
+++ b/libdap-stream-ch-vpn
@@ -1 +1 @@
-Subproject commit 61d2654814614f695c8abe2d1d8d2c7b1d7bcb40
+Subproject commit c864bcf8a5bfa89ee85237ee9809fdff1adef008
diff --git a/sources/node_manager.c b/sources/node_manager.c
index b4718111..e74742c3 100644
--- a/sources/node_manager.c
+++ b/sources/node_manager.c
@@ -26,54 +26,60 @@
 #define LOG_TAG "node_manager"
 
 
-void channel_new(struct stream_ch* ch,void* arg){
-    puts("Channel new");
+void channel_new(struct stream_ch* ch,void* arg)
+{
+    log_it(L_INFO,"Channel new");
 }
 
-void channel_delete(struct stream_ch* ch,void* arg){
-    puts("Channel delete");
+
+void channel_delete(struct stream_ch* ch,void* arg)
+{
+    log_it(L_INFO,"Channel delete");
 }
 
-void channel_packet_in(struct stream_ch* ch,void* arg){
+void channel_packet_in(struct stream_ch* ch,void* arg)
+{
     stream_ch_pkt_t * ch_pkt = arg;
     char* data = (char*)malloc(ch_pkt->hdr.size);
     memcpy(data,ch_pkt->data,ch_pkt->hdr.size);
-    printf("Income data: %s from %s \n",data,itoa(ch->stream->conn_udp->host_key));
+    log_it(L_DEBUG,"Income data: %s from %s \n",data,itoa(ch->stream->conn_udp->host_key));
     stream_ch_set_ready_to_write(ch,false);
     stream_ch_pkt_write_f(ch, 1, "ping");
     stream_ch_set_ready_to_write(ch,true);
 }
 
-void channel_packet_out(struct stream_ch* ch,void* arg){
+void channel_packet_out(struct stream_ch* ch,void* arg)
+{
     stream_ch_set_ready_to_write(ch,false);
 }
 
 
 void client_new(dap_client_remote_t *client,void * arg){
-    printf("Client connected");
+    log_it(L_INFO,"Client connected");
 }
 
 void client_read(dap_client_remote_t *client,void * arg){
-    printf("Client read \n");
+    log_it(L_INFO,"Client read %u",client->buf_in_size);
     unsigned char* data = (char*)malloc(client->buf_in_size);
     data[client->buf_in_size] = 0;
     if(client->_ready_to_read)
     {        
         dap_client_read(client,data,client->buf_in_size);
     }
-    puts(data);
     char outbox[] = "ping";
     dap_client_write(client,outbox,strlen(outbox));
     dap_udp_client_ready_to_write(client,true);
     free(data);
 }
 
-void client_write(dap_client_remote_t *client,void * arg){
-    printf("Client write");
+void client_write(dap_client_remote_t *client,void * arg)
+{
+    log_it(L_DEBUG,"Client write");
 }
 
-void client_disconnect(dap_client_remote_t *client,void * arg){
-    printf("Client disconnect");
+void client_disconnect(dap_client_remote_t *client,void * arg)
+{
+    log_it(L_DEBUG,"Client disconnect");
 }
 
 /**
@@ -164,7 +170,7 @@ void node_manager_start(node_manager_t* manager){
 
 void node_manager_start_stream(){
     dap_server_t* server = dap_server_listen("localhost",56001,DAP_SERVER_TCP);
-    dap_http_new(server,"HTTP-serv");
+    dap_http_new(server,"KelvinNode");
     enc_http_add_proc(DAP_HTTP(server),"/handshake");
     dap_server_loop(server);
 }
-- 
GitLab