: bharatvaj/forwarder

commit dae85ad9227aa68f637ef864ea5f68d853846f11
parent e451bd70b9062b9ec7897679eb013169f3ba67d1
Author: Bharatvaj H <bharatvaj@yahoo.com>
Date: Fri, 29 Mar 2019 01:54:27 +0530

Listen connect mode updated v2
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/forwarder.cpp b/forwarder.cpp
@@ -99,7 +99,7 @@ void bind_(shell4c::Operation op, vector<string> msg) {
   } else {
     IP *i = (IP *)nc->activeNetworks["IP"];
     int stat = system(
-        fmt::format("ip address add {} dev {}", msg[0], i->getNetworkParams())
+        fmt::format("ip address add {} dev {}", msg[1], i->getNetworkParams())
             .c_str());
     if (stat < 0) {
       shell.println("Operation failed");
diff --git a/include/NetworkController.hpp b/include/NetworkController.hpp
@@ -78,10 +78,12 @@ public:
         }
         Device *d2 = destNetwork->connect(bi->params);
         if (d2 == nullptr) {
+	fmt::print("Destination not found\n");
           // TODO ERROR HANDLE
           return;
         }
         Forwarder *forwarder = new Forwarder(&d, d2);
+	forwarder->start();
         forwarders.push_back(forwarder);
       });
       n->listen(nParams);

@@ -89,4 +91,4 @@ public:
   }
 };
 } // namespace wa
-#endif-
\ No newline at end of file
+#endif
diff --git a/include/network/Bluetooth.hpp b/include/network/Bluetooth.hpp
@@ -80,6 +80,7 @@ public:
     // connect to server
     int status = ::connect(s, (struct sockaddr *)&addr, sizeof(addr));
     Device *d = (Device *)new BluetoothDevice(s);
+    perror("socket");
     if(status < 0){
 	    return nullptr;
     }
diff --git a/include/network/IP.hpp b/include/network/IP.hpp
@@ -95,8 +95,8 @@ public:
     struct sockaddr_in peer;
     socklen_t peerLen = sizeof(peer);
         static int cont;
-    bool isTcp = false;
-    comm_socket fd = start_server(isTcp, 2500);
+    bool isTcp = true;
+    comm_socket fd = start_server(isTcp, 3500);
 
     if(fd < 0){
 	    cout << "Socket error" << endl;