Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/moses-smt/vowpal_wabbit.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Langford <jl@humpty.(none)>2010-10-19 17:45:22 +0400
committerJohn Langford <jl@humpty.(none)>2010-10-19 17:45:22 +0400
commite848e93280604f57b061b34ad691c00d3a79f2bd (patch)
tree7093812701356e5f8c248734c28252a7be42d491 /parser.cc
parent5627c8156e0a77e5d6abbeb26c9baa64675b415b (diff)
fixed reset/daemon interaction bug
Diffstat (limited to 'parser.cc')
-rw-r--r--parser.cc15
1 files changed, 14 insertions, 1 deletions
diff --git a/parser.cc b/parser.cc
index 6438bfbf..7acf5d8b 100644
--- a/parser.cc
+++ b/parser.cc
@@ -56,6 +56,14 @@ size_t cache_numbits(io_buf* buf, int filepointer)
return cache_numbits;
}
+bool member(v_array<int_pair> fd_ids, int fd)
+{
+ for (size_t i = 0; i < fd_ids.index(); i++)
+ if (fd_ids[i].fd == fd)
+ return true;
+ return false;
+}
+
void reset_source(size_t numbits, parser* p)
{
io_buf* input = p->input;
@@ -66,7 +74,12 @@ void reset_source(size_t numbits, parser* p)
p->write_cache = false;
p->output->close_file();
rename(p->output->currentname.begin, p->output->finalname.begin);
- input->close_files();
+ while(input->files.index() > 0)
+ {
+ int fd = input->files.pop();
+ if (!member(global.final_prediction_sink,fd))
+ close(fd);
+ }
input->open_file(p->output->finalname.begin,io_buf::READ); //pushing is merged into open_file
p->reader = read_cached_features;
}