Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
Looks like a copy-paste error.
|
|
Bug reported by MiMic.
|
|
hub_users_get() may return something for offline users, so is, on its
own, not suitable for checking whether a user is online or not.
(This has always been the case, these bugs were present before a27137d)
|
|
Fixes a bug introduced in previous commit.
|
|
This is a partial rewrite of the user list management code. Some
protocol-specific logic has been moved out of hub/users and into
hub/{adc,nmdc}, in order to simplify the logic in hub/users. In
particular:
* User ID generation is performed in hub/{adc/nmdc}
* The SID to user lookup table has been moved to hub/adc
* The deferred-user-online logic has been moved to hub/nmdc. This means
that new users are not added to the list in hub/users until they can
be considered as "online"
These changes fix a number of bugs:
* hub/adc previously assumed that, if the user ID was known, the user is
also online. This assumption didn't hold for uid=0, which resulted in
the users' SID and CID not getting updated on reconnect, breaking the
SID -> user lookup and causing a possible assertion failure (followed
by a crash) in hub/users on disconnect.
* Once a user leaves the hub, its struct object is not re-used later on
when the user reconnects. This did happen before, and could cause
information from the previous user to be re-added to the new user,
even if that information doesn't apply to the new user. hub/users had
no way of guarding against this bug because it had no way of telling
whether the user had been online before or not, due to the NMDC
deferred-info logic being merged into hub/users.
Since this is a fairly major change, this commit is likely to introduce
a few bugs on its own. Some more testing should reveal that, hopefully.
|
|
|
|
Actually specifying an array length invokes undefined behaviour. (Not
that I know of any compiler which uses array lengths within structs for
anything other than determining the size of the struct, but let's just
follow the spec.)
|
|
|
|
|
|
|
|
Using ecbuf for a list of pointers isn't in any way more efficient than
just using a linked list. This switch also avoids the ugly me flag
embedded in the allocated message. The message is now just stored as a
flexible array member to make each log entry a single memory allocation.
|
|
|
|
Too bad clang can't verify the correctness of my vector macros at
compile-time, then it would have seen that the value was never used
uninitialized. But since the point of the test suite is to test the
macros, and the macros may be doing something wrong and the value may
indeed end up staying uninitialized... the warning definitely pointed to
a bug.
|
|
|
|
The current macros are specially designed for ordered arrays, but it'd
be easy to add some macros for unordered arrays, too. Support for sparse
arrays (like klib/kvec) isn't on my agenda.
I'm no doubt going to need this abstraction for various things in the
future (especially share and download queue management), but this
current implementation is designed to replace the ugly array in
hub/manager.c with something more elegant (and potentially faster, but
it likely won't matter).
|
|
|
|
|
|
I really must have been sleeping.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The indirection is neither more clear/simple nor any more efficient.
|
|
|
|
|
|
|
|
|
|
This allows me to finally get rid of the ugly _emitcounts() function.
|
|
|
|
This doesn't require keeping this script in sync when new options are
added to globster.
Setting O_NONBLOCK flag may fix some buffering issues with the log
redirection.
|
|
I'm not quite convinced yet that this actually simplifies things. It
does make object creation a *tiny* bit more efficient.
This also changes the type of the dbo_<name>_interface variables,
because the pointer indirection didn't allow for using the pointer to
the interface struct as a compile-time constant.
|
|
|
|
They *are* constants, after all. Gcc now properly puts the structs into
the .rodata sections rather than .data. I have absolutely no idea if
that has any effect on memory usage or loading time, but it sure sounds
more efficient. :-)
|
|
|
|
Required for glibc < 2.17.
|
|
Both fixing a compilation bug.
|
|
Otherwise a deleted hub will come back on a restart.
|
|
Storing empty variables in the database is ugly.
|
|
|
|
|
|
No need to give a full address to Connect() every time.
|
|
Yay, Globster now properly remembers hub config across restarts. Now
it's finally safe to hardcode user IDs in scripts, too.
|
|
This way I get an integer back when I store an integer.
(I should be increasing the user_version with this and add the required
queries for updating. But that's kinda overkill as at this point.
Especially regarding the hub_vars table, I haven't even pushed that
commit yet.)
|
|
Currently fairly useless, since no hub information is ever *saved* to
the database. I'll get to that tomorrow.
|
|
This has the advantage that the hub id does no longer relate to how
things are organized in-memory. Which, in turn, allows the id to be
fairly large and/or more dynamic without affecting performance.
Since the hub list is now efficiently packed regardless of id gaps, this
should improve iteration performance a bit. And that's the operation
that matters most, since it's what hub_manager_infchange() does.
|