mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-08 19:22:29 +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;
|
||||
|
||||
} 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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user