Open AdamISZ opened 7 years ago
Note that this does not occur in all-in-one mode (no_daemon=1
in config), which is the default for both scripts and Joinmarket-Qt; noticed it for electrum, where that option is not currently used.
Isn't the current behaviour correct? Assume a single jmdaemon is used by multiple clients, they all will require different nicks and thus different connections.
@undeath's response to this very old issue was correct in as far as it goes. The problem was slightly wrongly characterised by me here.
On the one hand, starting a new protocol instance, with a new nick, clearly is correct. The problem I was observing here was just a result of the fact that there was not a 'shut down message channels' event on the completion of a task while the process is still running. This obviously didn't matter for one-and-done scripts where jmclient and jmdaemon were running in the same process, but did for a distinct joinmarketd.py
against which you ran multiple different tasks via command messages sent remotely.
I believe the problem was partially fixed, but only in new usage contexts, by the inclusion of request_mc_shutdown
. See these two use cases:
and
but I believe the problem would still exist for a user running a remote joinmarketd.py
and starting yieldgenerator multiple times with scripts; the old connections don't shut down (TODO: let's please check that that's actually true).
Assuming this analysis is still correct, it shows up something about refactoring the codebase pretty clearly:
jmclient.yield_generator.YieldGeneratorService
instead of isolated so we always do this the same way.
If joinmarketd is run persistently with new clients connecting, new instances of
JMDaemonServerProtocol
are created, meaning that the member variableself.irc_config
is reset to None, meaning a new IRC session + nick is created even though the IRC config is the same.The parts of the class instance which manage the connection should therefore be class variables, but this requires a bit of work. At least the messagechannelcollection object must be thus, and also it seems the orderbookwatch related data. So this is a bit more of a rework than I'd thought it would be. Also there might be something simpler than moving to class variables, perhaps moving these elements to the
JMDaemonServerProtocolFactory
, not sure.This isn't labeled as a bug because it does not break functionality, but any long running daemon used repeatedly by clients will create a bunch of useless IRC connections, so it nearly counts. Should be fixed soon.