thiezn / iperf3-python

Python wrapper around iperf3
https://iperf3-python.readthedocs.org/
MIT License
110 stars 51 forks source link

Ctrl+C doesn't terminate the Server() #2

Closed thiezn closed 8 years ago

thiezn commented 8 years ago

It seems that during the C library call to iperf_run_server(self._test) KeyboardInterrupt (aka Ctrl+C) isn't being passed onto the library. This causes the call to block indefinitely until either the server gets a client connection or the server process is killed.

A solution using threading has been proposed here but for the moment could not get it to work: http://stackoverflow.com/questions/14271697/ctrlc-doesnt-interrupt-call-to-shared-library-using-ctypes-in-python

thiezn commented 8 years ago

Fixed the issue in 25dbb77b4690195d251663126810bebd72887158 by using a thread for the C library run_server call as suggested in stackoverflow post.