Closed zapa1928 closed 3 years ago
There seems to be a thread waiting for a blocking(?) read to complete, before checking the exit flag. For example, press one more key on the physical keyboard after hitting Ctrl-C in the terminal, and you should see usb-mitm terminate. I'm no C expert, unfortunately, so have no idea how to fix this.
@RoganDawes Unfortunately another key-presses don't terminate the process.
Interesting! It does for me.
after adding
sigaction(SIGINT, &action, NULL);
in file usb-mitm.cpp line 69 it does break after third Ctrl+C
But expected behavior would be to stop after hitting it once. Can someone explain it to me?
It looks like Manager.cpp blocks in the following code section in order to wait for the reader threads to join:
if (in_readers[i]) {
if (in_readerThreads[i].joinable()) {
in_readerThreads[i].join();
}
delete(in_readers[i]);
in_readers[i]=NULL;
}
I am no cpp guy either, but I'll try to come up with a solution and post it here.
DeviceProxy_LibUSB::receive_data calls libusb_bulk_transfer with timeout 0, so timeout is unlimited. Remove timeout = 0; from void DeviceProxy_LibUSB::receive_data and thread will join.
Version ShmooCon_2015-109-g6a04 Running under kernel 4.19.94-ti-r42
When I try to exit the usm-mitm it tries to exit but doesn't finish.
In gdb it looks like this
I don't have any idea where to start with this