* Copy a torrent to std::stringstream instead of keeping a fstream open. This ensures rtorrent doesn't run out of file descriptors during launch.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1132 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2010-02-17 17:18:54 +00:00
parent 3cae3d37be
commit 0a76faa427
+7 -4
View File
@@ -135,12 +135,15 @@ DownloadFactory::receive_load() {
m_variables["tied_to_file"] = (int64_t)false;
} else {
std::fstream* stream = new std::fstream(rak::path_expand(m_uri).c_str(), std::ios::in | std::ios::binary);
m_stream = stream;
std::fstream stream(rak::path_expand(m_uri).c_str(), std::ios::in | std::ios::binary);
if (!stream.is_open())
return receive_failed("Could not open file");
m_stream = new std::stringstream;
m_isFile = true;
if (!stream->is_open())
return receive_failed("Could not open file");
*m_stream << stream.rdbuf();
receive_loaded();
}