Age | Commit message (Collapse) | Author |
|
This may fix problems with very large conferences. Sadly, it seems
infeasible to test large conferences on one machine, so this is entirely
theoretical.
|
|
This allows invitations to work in the case that the invitee is already
in the group, which can happen if the group becomes split. Such an
invitation is automatically accepted, leading to the peers becoming
connected in the group and sharing peer lists.
|
|
* make static functions return bool rather than int to indicate success
* add peer_in_list() to factor out uniformity over peer and frozen lists
* reduce repetition in send_lossy_all_close
* rename 'close' to 'connections'
* use uint32_t for peernumber (in accord with tox.c)
* explain persistence in tox_conference_get_chatlist documentation
* clarify "connectedness" in group API documentation
* clarify that tox_conference_peer_count counts only online peers
* refactor variously
|
|
Most of our enums already have one. Some didn't. Tokstyle is going to
require commas at the end of enumerator lists in enum definitions.
|
|
Tokstyle (check-cimple) will start enforcing comment formats at some
point. It will not support arbitrary stuff in comments, and will parse
them. The result can then be semantically analysed.
|
|
|
|
Using ~0 involves a bitwise operation on int, so depends on
the internal representation of signed integers.
|
|
|
|
Put a future message number into the save file.
Peers require the message numbers of messages we send to increase
monotonically. If we save the current message number, then send further
messages, then quit without saving (e.g. due to a crash), and then
resume from the old save data, then monotonicity will fail. This commit
works around this problem by introducing an offset when the current
message number, so that even in the above circumstance, as long as fewer
messages than the offset were sent between saving and reloading, the
sent message numbers will increase monotonically.
The choice of offset is a balance between wanting it to be large enough
that there is room for plenty of messages to be sent in the above
scenario, and wanting to avoid the following potential problem: if we
repeatedly save and reload without sending any further messages, then
the message number may increase so far that peers will interpret an
eventual message as being old. This is not conceivably a practical issue
for the 32bit lossless message numbers, but is a concern for the 16bit
lossy message numbers.
|
|
|
|
* unset global status callback in kill_groupchats
* avoid dangling friend connections
* fix num_introducer_connections leak
* stop trying to keep connection alive on freeze
* avoid relaying lossless messages back to sender where possible
* avoid sending gratuitous online packets
|
|
|
|
This fixes a buffer overflow when a malformed *.tox save file is
loaded.
|
|
|
|
A group loaded from a savefile starts with AV disabled.
|
|
(Implementing suggestions of sudden6)
|
|
|
|
* send freeze packet on quit
* delete existing peers with same real_pk on adding a peer
* record actual number of conference peers saved
|
|
|
|
* add global friend_connection status callback, used for group rejoining
* stop leaving groups on killing tox
|
|
to any peers
|
|
|
|
We were mistakenly not making a rejoin attempt on freezing connections
due to all closest connections going down. This fixes that, and tweaks
the test. I've still only done tens rather than hundreds of tests, but
I'm fairly confident that the conference test now consistently passes.
|
|
* add freezing and unfreezing of peers
* add rejoin packet
* revise handling of temporary invited connections
* rename "peer kill" packet to "peer leave" packet
* test rejoining in conference test
* use custom clock in conference test
|
|
|
|
|
|
|
|
Somehow it still works because the lower levels can deal with
inconsistent/broken state, but this lets us avoid that broken state in
the first place. If a friend connection doesn't exist, we don't add it to
our group.
|
|
The void pointer here only adds opportunity to introduce bugs and doesn't
actually make things more layered. It's just the code lying about being
layered while it's actually spaghetti.
|
|
|
|
|
|
Presumably the uses of `rand()` were fine because they were not used in
security-sensitive places, but having to think about whether a crappy RNG
is acceptable in each situation requires effort that could better be
spent elsewhere.
Also, this means that once we have a custom deterministic RNG for
testing, that RNG is used everywhere, so all the code is deterministic.
It also allowed us to delete a system-specific function that wasn't used
anywhere except in a call to `srand()`.
|
|
* test names in conference_test
* raise error on attempt to invite friend to group before we are connected
* revise handling of temporary invited connections
We are now careful not to prematurely delete a connection to a peer
established during the invitation process; namely, before we have sufficient
other connections and have confirmed that we have an alternative route to the
peer.
* process out-of-order messages from a peer
* don't reset names when handling a Peer Response
|
|
This almost entirely avoids any else-after-return in toxcore. One case is
left, and that one is more readable this way.
Why no else after return: https://llvm.org/docs/CodingStandards.html#don-t-use-else-after-a-return
Why exemptions exist: https://blog.mozilla.org/nnethercote/2009/08/31/no-else-after-return-considered-harmful/
|
|
Also moved some macros up to the beginning of `group.c`. This change
brings us closer to the PGC PR.
|
|
These are useful once we have persistent group chats, so clients can
store data associated with this permanent group identifier.
|
|
By changing numchats from uint32_t to uint16_t. This is done in PGC. This
PR is making that change in master to reduce the diff in the PGC branch.
Also:
* Inverted groupnumber_not_valid and renamed to is_groupnumber_valid.
* Renamed realloc_groupchats to realloc_conferences and made it return bool.
* Added setup_conference function that currently just zeroes the
conference structure but later will initialise more values.
* Made some `i` iterator variables local to the for-loop using
for-init-decl. This is also done in PGC.
|
|
Also some other cleanups. This PR means that future PRs, i.e. the PGC PR,
must not break the rules established here.
|
|
It turns out, `unix_time` is also monotonic, and is used as such, so I've
renamed the new functions to `mono_time_*`.
2018-07-08:
```
00:01 <@irungentoo> the idea used to be that the unix_time() function
could go backward in time but I think I might have started using it like
if it could not after I changed it so that it would never go back in time
```
|
|
We used to pass the actual peer numbers of peers leaving, but we no
longer know these in the PGC world, so we don't pass them anymore.
|
|
|
|
|
|
Fixes #768
|
|
We can now revert the changes to the callbacks and keep supporting them
until clients have moved off them.
|
|
fixes #606
|
|
|
|
The logic and behaviour remain the same, but PEER_EXIT and PEER_JOIN are
merged into LIST_CHANGED. This allows clients to take a first step to
adapt to the API change without us having to actually submit the full
change, yet.
|
|
This reverts commit e16d3894c5979fcfe1c57bf7dadc455ce690baf9 and
commit c5976e37eaadf663dc3d0c18376ea023355048f3.
|
|
This changes only code, no string literals or comments.
|
|
Turning this code:
```c
if (cond) { ... return 0; }
if (!cond) { ... return 0; }
return -1;
```
into:
```c
if (cond) { ... return 0; }
else { ... return 0; }
```
The `return -1` in the first variant can never happen.
|