diff --git a/aa_wireless_dongle/package/aawg/src/proxyHandler.cpp b/aa_wireless_dongle/package/aawg/src/proxyHandler.cpp index 266ca92..a795771 100644 --- a/aa_wireless_dongle/package/aawg/src/proxyHandler.cpp +++ b/aa_wireless_dongle/package/aawg/src/proxyHandler.cpp @@ -147,6 +147,8 @@ void AAWProxy::handleClient(int server_sock) { m_tcp_fd = -1; Logger::instance()->info("Forwarding stopped\n"); + Logger::instance()->info("Restart communication\n"); + return; } std::optional AAWProxy::startServer(int32_t port) { @@ -162,7 +164,16 @@ std::optional AAWProxy::startServer(int32_t port) { Logger::instance()->info("setsockopt failed: %s\n", strerror(errno)); return std::nullopt; } - + + struct timeval tv = { + .tv_sec = 30 + }; + + if (setsockopt(server_sock, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv))) { + Logger::instance()->info("setsockopt failed timeout set: %s\n", strerror(errno)); + return std::nullopt; + } + struct sockaddr_in address; address.sin_family = AF_INET; address.sin_addr.s_addr = INADDR_ANY; diff --git a/aa_wireless_dongle/package/aawg/src/usb.cpp b/aa_wireless_dongle/package/aawg/src/usb.cpp index b0a164a..d0e2ece 100644 --- a/aa_wireless_dongle/package/aawg/src/usb.cpp +++ b/aa_wireless_dongle/package/aawg/src/usb.cpp @@ -77,6 +77,9 @@ void UsbManager::disableGadget() { disableGadget(accessoryGadgetName); Logger::instance()->info("USB Manager: Disabled all USB gadgets\n"); + + enableGadget(defaultGadgetName); + Logger::instance()->info("USB Manager: Start default gadget after restart\n"); } void UsbManager::enableDefaultAndWaitForAccessory() {