Server list persistence for directory servers#1799
Server list persistence for directory servers#1799pljones wants to merge 1 commit intojamulussoftware:masterfrom
Conversation
f865765 to
782aae0
Compare
782aae0 to
258bb45
Compare
This seems a slightly arcane way of specifying the persistence file. Why not just add a command-line option such as |
|
And for that matter, what is wrong with having the server create an empty file if it is specified but does not already exist? |
I agree, but if it is limited to directory servers, we should probably have that context in the flag name. |
| sl.append ( QString::number ( this->iMaxNumClients ) ); | ||
| sl.append ( QString::number ( this->bPermanentOnline ) ); | ||
|
|
||
| return sl.join ( ";" ); |
There was a problem hiding this comment.
a server can have a semicolon in its name or city (when it is started from the GUI) and would get sorted out when loading the file.
Newline characters could also be added (when using --nogui) which could cause issues as well (probably would make sense to filter these out in general)
There was a problem hiding this comment.
Good points. We should make ; illegal in the GUI, in that case (and I can strip here), as it's illegal in --serverinfo. That was overlooked when adding the GUI. Same for newlines (which should never be allowed).
There was a problem hiding this comment.
A thought, after reviewing #1803 and #1804: those PRs only prevent the server itself creating names containing \n and ;; they don't do anything to prevent older registering servers from sending them to the directory. The code below strips out \n but not ;.
Also, I think there is some code duplicated between those PRs and this one? (e.g. reIllegal)
Volker avoided the problem of strange characters in names stored in the ini file by base64 encoding the names and writing in XML format. Maybe there is some code there that could be used here, instead of having to disallow characters?
There was a problem hiding this comment.
Not a bad idea. Convert the values to base64, then join with ;. It would save having to have the other two PRs, too.
There was a problem hiding this comment.
Just to note -- the INI file does not use base64 encoding for server name and city:
826 // name
827 PutIniSetting ( IniXMLDocument, "server", "name", pServer->GetServerName() );
828
829 // city
830 PutIniSetting ( IniXMLDocument, "server", "city", pServer->GetServerCity() );
Again, that's probably an oversight.
Because it's a file containing server info. It also avoids adding unnecessary code bloat. Basically, it's extra info for the directory server about servers. So there's no point adding a new option just for that, really. |
Because I expect anyone using the option to know what they're doing. This way it can be validated. If the file isn't there, it's more likely something isn't working and it's safer not to start guessing - so it issues a warning. I should really require it to be writeable on start up, too... |
258bb45 to
532d2ab
Compare
|
I see a few disadvantages in extending
also So IMO it makes sense have separate I'd even rather suggest to split |
Then that case can be dealt with if it ever arises.
No, that's not true. The directory server needs its own server info values as it's always in its own list.
Not part of this change. Also, I disagree with the need to split things out. I expect anyone setting up a directory server to be more than capable of using the existing command line parameter. |
@pljones, that's how it is right now. But logically it doesn't make sense that a directory server needs to be a server it its own list. My main idea is to not make the way to a more modular architecture harder. |
Yes, it does. The server has to register with itself ("localhost" and default port), otherwise it's not a directory server. As it can also be a jam server, it should supply details. All three Any Genre directories are jam servers, too. (I only limit jamming to a single client on my genre servers as I've limited uplink bandwidth.) |
d51dbc4 to
239ee9b
Compare
|
This is now running on Rock, Jazz, Classical/Folk and Choral/Barbershop genre servers. I have to admit, having messed up configuration the first time I set it up, having a separate command line option might make it easier. I'm also thinking splitting the Directory server only options out might be good, too - but not in this change. KISS (hence #1803 and #1804). In fact, I'll leave it as is for now - I'll add the new command line option separately and re-organise the list at that time. |
Could you please clarify why this is needed? Yes, currently a directory server is a normal Jamulus server which also allows "slave servers" to register with it. However, the Jam server functionality is not needed. From my tests with @passing's python library, It is perfectly ok and possible to have a directory which is not shown on the list. This could also work with your directories which are only limited to one user (which is honestly just an implementation workaround). |
|
I thought a while ago that it would be useful if a directory server could accept |
I agree and this was requested by users as well. We would still have to be careful because the first Directory server reply in the server list is handled specially in the client. @passing found a way around that though. Should probably create a new Issue for that topic if it is going to be implemented. |
Those are experiments with something not currently part of Jamulus. This is a change to improve the existing Jamulus Directory Server behaviour. I see no relationship.
It's not related to this work, so yes. |
2269f30 to
6075685
Compare
| // servers behind a NAT and dealing with external, public | ||
| // clients. | ||
| vecServerInfo[iIdx].HostAddr = ServerList[iIdx].LHostAddr; | ||
| // ?? Shouldn't this send the ping, as below ?? |
There was a problem hiding this comment.
Hrm, so this is about making the --serverpublicip Directory-side logic more consistent with the regular code path regarding NAT traversal, right?
I agree that a ping should be send to be as close to the normal path.
On the other hand, this feature is only used by people who already have the capability to set up proper port forwardings (otherwise they couldn't run a public directory server behind NAT). Therefore, I'd argue that it might not be necessary. As this hasn't been reported as a bug or missing feature either, I'd rather not do something right now. If anyone disagrees, please say so and I can open a PR.
b19ee0e to
2feed29
Compare
|
My directory servers now running this latest version (briefly having taken each down, reformatted the persistence file, then started up with the new version). |
2feed29 to
68460ba
Compare
See pljones#9 I've left the server list options in with the other server options for now:
|
|
pljones#9 now running all my directory servers. I'm probably going to merge that into this shortly. |
It would make sense to me to keep |
Currently, when restarting a directory server, it clears its list of registered servers. This means clients consulting the directory get an empty server list returned (well, containing the directory server itself only).
In order to make maintenance of directory servers less annoying for client users, this feature adds persistence of the list of registered servers across restarts.
Persistence is optional. It's enabled by specifying an existing, readable filename as an additional entry in the server info (i.e.
name;city;country;persistencefile). Providing an empty file the first time is mandatory.I have chosen not to add to the
--helpdisplay, as this is only for directory server lists. I needs adding to the appropriate Wiki page, however.When specified, the file is read on start up and written on shutdown (if writeable). Each line written to the file contains an entry from the server list (excluding the directory server itself). These are read on start up, prepopulating the list.
Servers must still re-register regularly to maintain their entry in the list.
NOTE: a7bb996 is #1803, on which this change depends.