* Fixed memory leaks in Control, ElementMenu and TextElementBranch.

* Check if RLIMIT_AS is present, else use RLIMIT_DATA.

* Don't add one to the timeout in display::Window::mark_dirty() so
that it updates the display immediately upon reorganizing the layout.

* Updated doc/rtorrent.1.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@759 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-08-15 23:15:47 +00:00
parent ee7016f547
commit 708e89ebad
8 changed files with 45 additions and 28 deletions
+15 -2
View File
@@ -3,7 +3,7 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "RTORRENT" "1" "05 July 2006" "BitTorrent client for ncurses" ""
.TH "RTORRENT" "1" "15 August 2006" "BitTorrent client for ncurses" ""
.SH NAME
rtorrent \- a BitTorrent client for ncurses
@@ -168,6 +168,14 @@ Set the maximum number of peers to allow in each download.
\fBmin_peers = \fIvalue\fB\fR
Set the minimum number of peers to try to connect to in each download.
.TP
\fBmax_peers_seed = \fIvalue\fB\fR
Set the maximum number of peers to allow while seeding, or -1 (default) to use
max_peers.
.TP
\fBmin_peers_seed = \fIvalue\fB\fR
Set the minimum number of peers to try to connect to while seeding, or -1 (default) to use
min_peers.
.TP
\fBmax_uploads = \fIvalue\fB\fR
Set the maximum number of simultaneous uploads per download.
.TP
@@ -318,7 +326,8 @@ match for the download to be included.
Change the key-bindings.
.SH "ADVANCED SETTINGS"
.PP
This list contains settings users shouldn't need to touch.
This list contains settings users shouldn't need to touch, some may
even cause crashes or similar if incorrectly set.
.TP
\fBhash_read_ahead = \fIMB\fB\fR
Configure how far ahead we ask the kernel to read when doing hash
@@ -334,6 +343,10 @@ Number of attempts to check the hash while using the mincore status,
before forcing. Overworked systems might need lower values to get a
decent hash checking rate.
.TP
\fBsafe_sync = \fIyes|no\fB\fR
Always use MS_SYNC rather than MS_ASYNC when syncing chunks. This may
be nessesary in case of filesystem bugs like NFS in linux ~2.6.13.
.TP
\fBmax_open_files = \fIvalue\fB\fR
Number of files to simultaneously keep open. Libtorrent dynamically
opens and closes files when mapping files to memory. Defaults to 128.
+3
View File
@@ -93,9 +93,12 @@ Control::~Control() {
delete m_commandScheduler;
delete m_variables;
delete m_viewManager;
delete m_ui;
delete m_display;
delete m_core;
delete m_scheduler;
delete m_clientInfo;
}
+1 -1
View File
@@ -121,7 +121,7 @@ Canvas::print(unsigned int x, unsigned int y, const char* str, ...) {
va_start(arglist, str);
wmove(m_window, y, x);
vw_printw(m_window, str, arglist);
vw_printw(m_window, const_cast<char*>(str), arglist);
va_end(arglist);
}
+2
View File
@@ -48,6 +48,7 @@ public:
TextElementBranchVoid(const slot_type& slot, TextElement* branch1, TextElement* branch2) :
m_slot(slot), m_branch1(branch1), m_branch2(branch2) {}
~TextElementBranchVoid() { delete m_branch1; delete m_branch2; }
virtual char* print(char* first, char* last, Canvas::attributes_list* attributes, void* object) {
if (m_slot())
@@ -76,6 +77,7 @@ public:
TextElementBranch(const slot_type& slot, TextElement* branch1, TextElement* branch2) :
m_slot(slot), m_branch1(branch1), m_branch2(branch2) {}
~TextElementBranch() { delete m_branch1; delete m_branch2; }
virtual char* print(char* first, char* last, Canvas::attributes_list* attributes, void* object) {
if (object == NULL)
+3 -1
View File
@@ -85,8 +85,10 @@ public:
bool is_width_dynamic() const { return m_maxWidth > m_minWidth; }
bool is_height_dynamic() const { return m_maxHeight > m_minHeight; }
// Do not call mark_dirty() from withing redraw() as it may cause
// infinite looping in the display scheduler.
bool is_dirty() { return m_taskUpdate.is_queued(); }
void mark_dirty() { if (!is_active()) return; m_slotSchedule(this, cachedTime + 1); }
void mark_dirty() { if (!is_active()) return; m_slotSchedule(this, cachedTime); }
extent_type min_width() const { return m_minWidth; }
extent_type min_height() const { return m_minHeight; }
+2 -1
View File
@@ -98,7 +98,8 @@ WindowHttpQueue::cleanup_list() {
else
++itr;
mark_dirty();
// Bad, can't have this here as it is called from redraw().
// mark_dirty();
}
std::string
+9 -18
View File
@@ -48,22 +48,15 @@
namespace ui {
struct ElementMenuEntry {
display::TextElementStringBase* m_element;
ElementMenu::slot_type m_slotFocus;
ElementMenu::slot_type m_slotSelect;
};
inline void
ElementMenu::focus_entry(size_type idx) {
if (idx >= size())
return;
if (m_focus)
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_reverse);
base_type::operator[](idx).m_element->set_attributes(display::Attributes::a_reverse);
else
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_bold);
base_type::operator[](idx).m_element->set_attributes(display::Attributes::a_bold);
}
inline void
@@ -71,7 +64,7 @@ ElementMenu::unfocus_entry(size_type idx) {
if (idx >= size())
return;
base_type::operator[](idx)->m_element->set_attributes(display::Attributes::a_normal);
base_type::operator[](idx).m_element->set_attributes(display::Attributes::a_normal);
}
ElementMenu::ElementMenu() :
@@ -79,7 +72,7 @@ ElementMenu::ElementMenu() :
m_entry(entry_invalid) {
// Move bindings into a function that defines default bindings.
m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_LEFT] = sigc::mem_fun(&m_slotExit, &slot_type::operator());
m_bindings[KEY_RIGHT] = sigc::mem_fun(this, &ElementMenu::entry_select);
m_bindings[KEY_UP] = m_bindings['P' - '@'] = sigc::mem_fun(this, &ElementMenu::entry_prev);
@@ -122,7 +115,7 @@ ElementMenu::disable() {
void
ElementMenu::push_back(const char* name, const slot_type& slotSelect, const slot_type& slotFocus) {
entry_type* entry = new entry_type;
iterator entry = base_type::insert(end(), value_type());
entry->m_element = new display::TextElementCString(name);
entry->m_slotSelect = slotSelect;
@@ -131,8 +124,6 @@ ElementMenu::push_back(const char* name, const slot_type& slotSelect, const slot
m_window->push_back(NULL);
m_window->push_back(entry->m_element);
base_type::push_back(entry);
// For the moment, don't bother doing anything if the window is
// already active.
m_window->mark_dirty();
@@ -149,7 +140,7 @@ ElementMenu::entry_next() {
m_entry = 0;
focus_entry(m_entry);
base_type::operator[](m_entry)->m_slotFocus();
base_type::operator[](m_entry).m_slotFocus();
m_window->mark_dirty();
}
@@ -165,7 +156,7 @@ ElementMenu::entry_prev() {
m_entry = size() - 1;
focus_entry(m_entry);
base_type::operator[](m_entry)->m_slotFocus();
base_type::operator[](m_entry).m_slotFocus();
m_window->mark_dirty();
}
@@ -175,7 +166,7 @@ ElementMenu::entry_select() {
if (m_entry >= size())
return;
base_type::operator[](m_entry)->m_slotSelect();
base_type::operator[](m_entry).m_slotSelect();
m_window->mark_dirty();
}
@@ -190,7 +181,7 @@ ElementMenu::set_entry(size_type idx, bool triggerSlot) {
focus_entry(m_entry);
if (triggerSlot)
base_type::operator[](m_entry)->m_slotFocus();
base_type::operator[](m_entry).m_slotFocus();
m_window->mark_dirty();
}
+10 -5
View File
@@ -45,17 +45,22 @@
namespace display {
class WindowText;
class TextElementStringBase;
}
namespace ui {
struct ElementMenuEntry;
struct ElementMenuEntry {
display::TextElementStringBase* m_element;
class ElementMenu : public ElementBase, public std::vector<ElementMenuEntry*> {
sigc::slot0<void> m_slotFocus;
sigc::slot0<void> m_slotSelect;
};
class ElementMenu : public ElementBase, public std::vector<ElementMenuEntry> {
public:
typedef ElementMenuEntry entry_type;
typedef std::vector<entry_type*> base_type;
typedef sigc::slot0<void> slot_type;
typedef std::vector<ElementMenuEntry> base_type;
typedef sigc::slot0<void> slot_type;
typedef display::WindowText WindowText;