mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-10 08:09:21 +00:00
* 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:
@@ -135,12 +135,15 @@ DownloadFactory::receive_load() {
|
|||||||
m_variables["tied_to_file"] = (int64_t)false;
|
m_variables["tied_to_file"] = (int64_t)false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
std::fstream* stream = new std::fstream(rak::path_expand(m_uri).c_str(), std::ios::in | std::ios::binary);
|
std::fstream stream(rak::path_expand(m_uri).c_str(), std::ios::in | std::ios::binary);
|
||||||
m_stream = stream;
|
|
||||||
|
if (!stream.is_open())
|
||||||
|
return receive_failed("Could not open file");
|
||||||
|
|
||||||
|
m_stream = new std::stringstream;
|
||||||
m_isFile = true;
|
m_isFile = true;
|
||||||
|
|
||||||
if (!stream->is_open())
|
*m_stream << stream.rdbuf();
|
||||||
return receive_failed("Could not open file");
|
|
||||||
|
|
||||||
receive_loaded();
|
receive_loaded();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user