> The streamer thread might not exit (hence the streamer.join() might block indefinitely) if the reponseder thread is not closed (via response.close()).
I don't see dataStreamer waiting for repsonse to close(). If it is not closed, it closes it.
I think attached patch is fine. I checked the peripheral code again and I don't see it introducing any new problem and fixes this bug. Does anyone see why it is wrong? If this fix is ok, I will submit a slightly reformatted patch (i.e. bring all the references to 'response' inside closeInternal() to one place).