When we are waiting for new trail files we may have been disconnected and

reconnected in the meantime. Check if reset is set before opening next trail
file, as not doing so will result in sending OPEN message with the same
file name twice and this is illegal - the second OPEN is send without first
closing previous trail file.
This commit is contained in:
Pawel Jakub Dawidek 2013-02-28 01:24:24 +00:00
parent eff269ee18
commit a66ffea41d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=247442

View File

@ -394,6 +394,7 @@ read_thread_wait(void)
mtx_lock(&adist_remote_mtx);
if (adhost->adh_reset) {
reset:
adhost->adh_reset = false;
if (trail_filefd(adist_trail) != -1)
trail_close(adist_trail);
@ -408,6 +409,14 @@ read_thread_wait(void)
while (trail_filefd(adist_trail) == -1) {
newfile = true;
wait_for_dir();
/*
* We may have been disconnected and reconnected in the
* meantime, check if reset is set.
*/
mtx_lock(&adist_remote_mtx);
if (adhost->adh_reset)
goto reset;
mtx_unlock(&adist_remote_mtx);
if (trail_filefd(adist_trail) == -1)
trail_next(adist_trail);
}