From c82b0119264a19e7267d1493cd554da343114e08 Mon Sep 17 00:00:00 2001
From: Konstantin Kukharenko <konstantin.kuharenko@demlabs.net>
Date: Tue, 24 Sep 2024 21:19:13 +0300
Subject: [PATCH] [*] serch problem with connect

---
 .../net/srv/vpn/DapStreamChChainNetSrvVpn.cpp | 31 +++++++++++++------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/stream/ch/chain/net/srv/vpn/DapStreamChChainNetSrvVpn.cpp b/stream/ch/chain/net/srv/vpn/DapStreamChChainNetSrvVpn.cpp
index 6cca15a8..a1d41de8 100644
--- a/stream/ch/chain/net/srv/vpn/DapStreamChChainNetSrvVpn.cpp
+++ b/stream/ch/chain/net/srv/vpn/DapStreamChChainNetSrvVpn.cpp
@@ -398,37 +398,50 @@ void ChChainNetSrvVpn::onPktIn(DapChannelPacket* pkt)
 
             break;
             QTcpSocket *sc=m_socketsIn[pktSF->header.socket_id];
-            if (sc) {
+            if (sc) 
+            {
                 m_socketsIn.remove(pktSF->header.socket_id);
                 sc->close();
-            } else {
+            }
+            else
+            {
                 qDebug() <<" Unknown socket_id "<<pktSF->header.socket_id;
             }
         } break;
-        case STREAM_SF_PACKET_OP_CODE_RECV:{
+        case STREAM_SF_PACKET_OP_CODE_RECV:
+        {
             QTcpSocket *sc=m_socketsIn[pktSF->header.socket_id];
-            if (sc) {
+            if (sc) 
+            {
                 sc->write((const char*)pktSF->data, pktSF->header.op_data.data_size);
-            } else {
+            }
+            else 
+            {
                 qDebug() <<" Unknown socket_id "<<pktSF->header.socket_id;
             }
         } break;
-        case STREAM_SF_PACKET_OP_CODE_RAW_L3_ADDR_REPLY:{
+        case STREAM_SF_PACKET_OP_CODE_RAW_L3_ADDR_REPLY:
+        {
             quint32 l_addr,l_gw;
             ::memcpy(&l_addr, pktSF->data,sizeof (l_addr));
             ::memcpy(&l_gw, pktSF->data+sizeof (l_addr),sizeof (l_addr));
             QString new_addr    = QHostAddress(  ntohl(l_addr) ).toString();
             QString new_gw      = QHostAddress( ntohl ( l_gw )).toString();
-            if (m_addr == new_addr && new_gw == m_gw) {
+            if (m_addr == new_addr && new_gw == m_gw) 
+            {
                 qDebug() << "Net config is the same, we don't touch Tun";
                 emit netConfigReceivedSame();
-            } else {
+            } 
+            else 
+            {
+                qDebug() << "Net config received";
                 m_addr = new_addr;
                 m_gw = new_gw;
                 emit netConfigReceived(m_addr,m_gw);
             }
         } break;
-        case STREAM_SF_PACKET_OP_CODE_RAW_RECV:{
+        case STREAM_SF_PACKET_OP_CODE_RAW_RECV:
+        {
             pkt->unleashData(); // Uleash *data section from pkt object
             tun->tunWriteData(pktSF);
         }break;
-- 
GitLab