Skip to content

Conversation

@jonasschnelli
Copy link
Contributor

It looks like, TorController::disconnected_cb(TorControlConnection& conn) gets called multiple times which results in multiple event_new().

Needs testing!

2016-02-26 19:29:42 setKeyPool.size() = 101
2016-02-26 19:29:42 mapWallet.size() = 2202
2016-02-26 19:29:42 mapAddressBook.size() = 4
2016-02-26 19:29:42 init message: Loading addresses...
2016-02-26 19:29:42 torcontrol thread start
2016-02-26 19:29:42 tor: Error connecting to Tor control socket
2016-02-26 19:29:42 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
2016-02-26 19:29:43 Loaded 0 addresses from peers.dat  1732ms
2016-02-26 19:29:43 tor: Error connecting to Tor control socket
2016-02-26 19:29:43 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
2016-02-26 19:29:43 init message: Loading banlist...
2016-02-26 19:29:45 tor: Error connecting to Tor control socket
2016-02-26 19:29:45 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect
2016-02-26 19:29:46 dnsseed thread start
2016-02-26 19:29:46 net thread start

@laanwj
Copy link
Member

laanwj commented Feb 29, 2016

utACK
nit: event_free implies event_del, doing both is unnecessary

@theuni
Copy link
Member

theuni commented Mar 1, 2016

Why free/create every time the event is set? They're reusable.
How about just event_new in the ctor, event_free in the dtor, and event_add as needed?

Edit: The naming may be confusing to those unfamiliar with libevent. event_new allocates, event_add schedules a new event, event_del un-schedules if not yet run, event_free deallocates. I suggest just making it RAII-like.

@laanwj
Copy link
Member

laanwj commented Mar 1, 2016

Good point @theuni!

laanwj added a commit to laanwj/bitcoin that referenced this pull request Mar 3, 2016
It looks like, TorController::disconnected_cb(TorControlConnection&
conn) gets called multiple times which results in multiple event_new().

Avoid this by creating the event only once in the constructore, and
deleting it only once in the destructor (thanks to Cory Fields for the
idea).

Replaces the fix by Jonas Schnelli in bitcoin#7610, see discussion there.
@laanwj
Copy link
Member

laanwj commented Mar 3, 2016

Closing in favor of #7637

@maflcko
Copy link
Member

maflcko commented Apr 25, 2016

Removing label 'needs backport'

maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Apr 27, 2016
It looks like, TorController::disconnected_cb(TorControlConnection&
conn) gets called multiple times which results in multiple event_new().

Avoid this by creating the event only once in the constructore, and
deleting it only once in the destructor (thanks to Cory Fields for the
idea).

Replaces the fix by Jonas Schnelli in bitcoin#7610, see discussion there.

Github-Pull: bitcoin#7637
Rebased-From: e219503
thokon00 pushed a commit to faircoin/faircoin that referenced this pull request Jun 28, 2016
It looks like, TorController::disconnected_cb(TorControlConnection&
conn) gets called multiple times which results in multiple event_new().

Avoid this by creating the event only once in the constructore, and
deleting it only once in the destructor (thanks to Cory Fields for the
idea).

Replaces the fix by Jonas Schnelli in bitcoin#7610, see discussion there.

Github-Pull: bitcoin#7637
Rebased-From: e219503
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants