Skip to content

Commit 835cf51

Browse files
fix: added extra traces for closed socket.
1 parent 67099fa commit 835cf51

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

IOSDeviceLib/IOSDeviceLib.cpp

+14-2
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <string>
1010
#include <sys/stat.h>
1111
#include <thread>
12+
#include <utility>
1213

1314
#include "CommonFunctions.h"
1415
#include "DevicectlHelper.h"
@@ -1623,10 +1624,21 @@ void connect_to_port(std::string device_identifier, int port,
16231624

16241625
// Proxy the messages from the client socket to the device socket
16251626
// and from the device socket to the client socket.
1627+
auto on_device_socket_closed = [](SOCKET client_fd) {
1628+
trace("Device socket has been closed. Closing client socket.");
1629+
close_socket(client_fd);
1630+
};
1631+
1632+
auto on_client_socket_closed = [=](SOCKET d_fd) {
1633+
trace("Client socket has been closed. Closing associated device proxy "
1634+
"server.");
1635+
devices[device_identifier].kill_device_server();
1636+
};
1637+
16261638
proxy_socket_io(
16271639
device_socket, client_socket,
1628-
[](SOCKET client_fd) { close_socket(client_fd); },
1629-
[=](SOCKET d_fd) { devices[device_identifier].kill_device_server(); });
1640+
std::move(on_device_socket_closed),
1641+
std::move(on_client_socket_closed));
16301642
}
16311643
}
16321644

0 commit comments

Comments
 (0)