1
Fork 0
Commit Graph

150 Commits

Author SHA1 Message Date
Juliusz Chroboczek 51c31ab729 Improve error handling for negotiation failures.
Now that we constrain tracks in offers properly, there is no need
to manually check that the codecs have been matched correctly.
2021-08-02 20:00:23 +02:00
Juliusz Chroboczek 816b7a54df Restrict negotiation of downstream codecs, allow multiple profiles.
We now restrict the allowable codecs in the downstream direction,
which leads to a clean failure instead of a silent track.  We also
allow multiple profiles for a single codec.
2021-08-02 18:08:37 +02:00
Juliusz Chroboczek efb298f002 Use sendonly transceiver for down tracks, embed receiver in track. 2021-08-01 13:33:01 +02:00
Juliusz Chroboczek b527c8757a Add chathistory message. 2021-07-31 14:42:26 +02:00
Juliusz Chroboczek 97a5bf60ad Send the locked user-friendly message in the group status. 2021-07-30 19:44:39 +02:00
Juliusz Chroboczek 3b98e123e0 Send a message of kind "kicked" instead of "error". 2021-07-30 19:38:02 +02:00
Juliusz Chroboczek a5c97fd849 Add System permission.
This replaces the OverridePermissions method, and is communicated
to clients that can reliably and safely identify a system user.
2021-07-30 19:26:34 +02:00
Juliusz Chroboczek 52a26327d7 Implement group status.
We now inform clients of the status of a group (locked, etc.).  Also
cleans up the handling of administrative messages, which solves the
issue of receiving "user" before "joined".
2021-07-16 19:51:54 +02:00
Juliusz Chroboczek 6ae79f21d6 Use unbounded buffer for track actions.
Without that, we might deadlock if the reader is blocked in read.
2021-07-16 03:03:45 +02:00
Juliusz Chroboczek c540cad994 Move pushClientConnection into its own function. 2021-07-16 01:40:42 +02:00
Juliusz Chroboczek 053067548a Ensure that replaced down tracks are closed even on failure.
Thanks to Ludovic Rateau.
2021-07-15 23:52:03 +02:00
Juliusz Chroboczek 9b8d868647 Fix a race between delUpConn and addLocal.
We could call addLocal after the remote was closed, which
would cause the local connection to remain forever.

Thanks to Ludovic Rateau.
2021-07-15 16:03:06 +02:00
Juliusz Chroboczek 36d31f0db8 Maintain a reference to the connection associated to each track.
This avoids carrying an extra parameter in many places.
2021-07-14 14:05:23 +02:00
Juliusz Chroboczek 2da8faa8cf Implement per-stream requests. 2021-05-14 23:21:14 +02:00
Juliusz Chroboczek 515c4a5cd0 Rename pushConns to requestConns, move into Client interface.
Also allow selecting just a single connection.
2021-05-14 23:21:14 +02:00
Juliusz Chroboczek 6f9d7fc306 Scalable video coding (SVC). 2021-05-14 23:21:14 +02:00
Juliusz Chroboczek 7590588a54 Don't renegotiate if nothing changed during a request. 2021-05-14 18:19:44 +02:00
Juliusz Chroboczek d236f4c6df Work around empty track id and msid. 2021-05-13 03:45:32 +02:00
Juliusz Chroboczek 26bf8a341a Don't send client parameters in delete message.
This avoids a race condition since the delete messages are sent
asynchronously.
2021-05-10 16:58:28 +02:00
Juliusz Chroboczek 795a40ceaf Simulcast. 2021-05-08 21:12:29 +02:00
Juliusz Chroboczek be73380f9f Label streams, not tracks.
We used to label tracks individually, in a view to using the labelling
for simulcast.  Since then, the WebRTC community has converged on a
different strategy, where multiple tracks share a single mid and
are labelled with the rid extension.

We now label whole streams, which is simpler, and use the track's
kind (and, in the future, the rid) to disambiguate.  This changes the
protocol in two ways:

  * in offers, the "labels" dictionary is replaced by a single "label"
    field; and
  * the syntax of the "request" message has changed.
2021-04-29 18:28:16 +02:00
Juliusz Chroboczek 3ba2394be7 Implement user statuses.
The server now maintains a set of statuses for each user that are not
interpreted by the server but communicated to the other members of the
group using 'user' messages.
2021-04-28 17:01:05 +02:00
Juliusz Chroboczek f0a39fca48 Send user permissions to client.
We now maintain the user list in the serverConnection.
2021-04-28 00:07:19 +02:00
Juliusz Chroboczek fef38bc53f Protect against requesting when no group is joined.
Thanks to gregfr.
2021-04-15 12:07:05 +02:00
Juliusz Chroboczek ea321be17a Make Kick part of the Client interface.
All clients implement Kick, no need for a separate interface.
2021-02-26 16:20:13 +01:00
Juliusz Chroboczek ddb6039fa6 Fix error handling in client actions.
Thanks to Yacine.
2021-02-17 20:55:11 +01:00
Juliusz Chroboczek 260597d595 Ensure actions happen in order. 2021-02-15 00:35:09 +01:00
Juliusz Chroboczek 183ab4fed7 Use an unbounded buffer for client actions.
We no longer risk deadlocking when sending actions, which in turn
enables pushing connections synchronously.
2021-02-14 17:24:42 +01:00
Juliusz Chroboczek 3b505a89fe Factor out handling actions. 2021-02-14 16:47:36 +01:00
Juliusz Chroboczek 3c7b32056b Reduce writer timeout, increase amount of buffering.
If the writer gets congested, the whole group might be delayed.  Better
to drop the slow client in that case.
2021-02-14 16:26:56 +01:00
Juliusz Chroboczek 0261558e07 Protect against empty ids. 2021-02-05 16:07:58 +01:00
Juliusz Chroboczek c3a19c9128 Avoid race between closing connections and terminating client.
We need to terminate all down connections synchronously, otherwise
we risk leaving open connections lying around.
2021-02-05 12:20:33 +01:00
Juliusz Chroboczek 66de0d16e7 Fix closing of replaced connections. 2021-02-04 23:51:51 +01:00
Juliusz Chroboczek 0ce509c62c Revert "Log client errors."
We're already logging in the caller.

This reverts commit f4811e8cf5.
2021-02-04 22:44:14 +01:00
Juliusz Chroboczek 263258a0c1 Implement renegotiation of down streams.
We used to destroy and recreate down streams whenever something changed,
which turned out to be racy.  We now properly implement renegotiation,
as well as atomic replacement of a stream by another one.
2021-02-03 19:15:40 +01:00
Juliusz Chroboczek f34ec0ab66 Don't hide mismatches in the PeerConnection state automaton.
The previous behaviour led to silent failures, which was confusing.
2021-02-02 22:57:56 +01:00
Juliusz Chroboczek f4811e8cf5 Log client errors. 2021-02-02 22:46:54 +01:00
Juliusz Chroboczek d9e72f4fd0 Return an error when adding a duplicate down track. 2021-02-02 22:46:48 +01:00
Juliusz Chroboczek 36d6845dc1 Fix closing of replaced connections. 2021-02-01 14:08:54 +01:00
Juliusz Chroboczek 14a4303664 Rework connection replacement.
We used to signal connection replacement by reusing the same connection
id.  This turned out to be racy, as we couldn't reliably discard old
answers after a connection id was refused.

We now use a new id for every new connection, and explicitly signal
stream replacement in the offer message.  This requires maintaining a
local id on the client side.
2021-01-31 23:59:17 +01:00
Juliusz Chroboczek f0dcd0b1d9 Rework locking of tracks.
We now add tracks after the stream has been pushed, so we need a lock
on down streams.  Also rework sendUpRTCP to reduce locking.
2021-01-19 23:55:33 +01:00
Juliusz Chroboczek 9a5c8b6b43 Handle answers in stable state.
Don't break the stream, just ignore the SDP.
2021-01-19 23:30:01 +01:00
Juliusz Chroboczek 6098d4af9d Implement autolock. 2021-01-14 03:56:37 +01:00
Juliusz Chroboczek 49bcc342ed Queue negotiation if not in stable state.
If we send two offers back to back, the second answer will arive in
stable state, which will confuse us.  Instead, queue the second offer.
2021-01-12 20:44:48 +01:00
Juliusz Chroboczek 820b303e84 Send localDescription instead of original SDP. 2021-01-11 20:41:34 +01:00
Juliusz Chroboczek dad113c1f9 Generate transceivers from incoming SDP. 2021-01-11 20:24:09 +01:00
Juliusz Chroboczek 63e2b5a4c4 Implement 'noecho' field in client messages. 2021-01-11 16:30:07 +01:00
Juliusz Chroboczek 617aee325f Reduce ping timetout to 45 to 55s.
Thanks to Jeroen van Veen for the debugging.
2021-01-08 14:05:02 +01:00
Juliusz Chroboczek 7f4306ab3b Optimise broadcast messages.
Avoid formatting JSON multiple times.
2021-01-04 18:28:54 +01:00
Juliusz Chroboczek 0ec9f92dad Make 'clearchat' into a user message. 2021-01-03 17:47:56 +01:00
Juliusz Chroboczek e393819eda Carry raw SDP in the protocol. 2021-01-03 17:00:58 +01:00
Juliusz Chroboczek f53276b89e Simplify the protocol and the protocol interface.
Split the id field into id and source, where source indicates the sender
of the message and id the entity being sent.  Remove the label request,
just use the offerer's username.  Maintain the username within the
ServerConnection, this removes a parameter from some methods.
2021-01-03 12:17:30 +01:00
Juliusz Chroboczek 450601f0e8 Move ICE code into own module, add tests. 2021-01-02 00:21:17 +01:00
Juliusz Chroboczek dbec9df288 Use Pion's JSON support for ICE configuration. 2021-01-01 22:28:38 +01:00
Juliusz Chroboczek a0418d26ec Send RTC configuration with joined message.
This avoids one HTTP request, and is potentially more flexible.
2020-12-28 02:55:19 +01:00
Juliusz Chroboczek d09c0f0a80 Make the value field of client messages carry arbitrary types. 2020-12-28 01:49:27 +01:00
Juliusz Chroboczek 9e4aede72a Fix issues with unaligned atomic operations.
This could be solved by simply reordering the fields, but it
is more robust to move the atomics into their own structure,
and the extra indirection should not cost much.
2020-12-27 01:31:31 +01:00
Juliusz Chroboczek 2785fa9f77 Store labels early.
This avoids spurious up.complete indications.
2020-12-25 22:32:30 +01:00
Juliusz Chroboczek f4379f7a8c Protect against negotiation inconsistencies.
This is not an issue in the current code, assuming that clients
negotiate correctly, but will become one once we implement codec
flexibility.
2020-12-25 20:50:33 +01:00
Juliusz Chroboczek d5c7a13aae Implement abort in the client->server direction. 2020-12-25 18:51:17 +01:00
Juliusz Chroboczek d43a2b0104 Implement WallOps to send a warning to all operators. 2020-12-23 23:15:36 +01:00
Juliusz Chroboczek 4fde2c40e6 Run gofmt. 2020-12-19 17:38:47 +01:00
Juliusz Chroboczek 325f288189 Move to github. 2020-12-19 17:37:48 +01:00
Juliusz Chroboczek a2f5bb82d1 Delete unrequested connections in addDownConnTracks.
We don't renegotiate down connections yet, but this is a latent bug.
2020-12-18 18:56:07 +01:00
Antonin Décimo f5de94cf3e Correct spelling of privileged. 2020-12-15 14:52:46 +01:00
Juliusz Chroboczek da8c592232 Fix log message.
Thanks to Antonin Décimo.
2020-12-12 23:21:49 +01:00
Juliusz Chroboczek 4de2953037 Fix incorrect closure in pushConnsAction.
This was causing us to lose connections.
2020-12-09 01:05:24 +01:00
Juliusz Chroboczek ef1c211b7f SFU is now called Galène. 2020-12-06 19:51:02 +01:00
Juliusz Chroboczek 2d07c5d317 Move to Pion v3 API. 2020-12-06 11:15:59 +01:00
Juliusz Chroboczek e8c732c54c Fix error handling at websocket close. 2020-12-05 03:07:22 +01:00
Juliusz Chroboczek 26e6ecc3bc Fix error handling on negotiation failure. 2020-12-05 00:32:01 +01:00
Juliusz Chroboczek 0e7bf0b348 Carry group around when pushing connections.
This avoids a race condition if the group changes before the connections
are pushed.
2020-12-05 00:07:34 +01:00
Juliusz Chroboczek b134bfcf13 Improve error handling on join failure.
Solves the issue of groups with a name ending in "/".
2020-12-04 22:56:29 +01:00
Juliusz Chroboczek e3098899e1 Log errors from PushConn. 2020-12-04 12:15:37 +01:00
Juliusz Chroboczek ca6c371ec4 Send chat history after joined message.
This was broken when we eliminated the login message.
2020-12-04 11:31:20 +01:00
Juliusz Chroboczek 27a2e45500 Implement /subgroups. 2020-12-02 19:47:32 +01:00
Juliusz Chroboczek 43047fc00e Allow empty values in clientMessage. 2020-12-02 19:33:53 +01:00
Juliusz Chroboczek 2546aae7c1 Eliminate login from protocol.
The login message is replaced with handshake, which only carries
the client id.  Username and password is now in the join message.
Permissions is replaced with joined.
2020-12-02 13:49:53 +01:00
Juliusz Chroboczek b30d4fe537 Add delay after login failure. 2020-12-02 00:07:31 +01:00
Juliusz Chroboczek 6e5348101c Propagate kick originators. 2020-11-30 20:04:58 +01:00
Juliusz Chroboczek ed531cefc2 More spoofing protection. 2020-11-30 20:04:58 +01:00
Juliusz Chroboczek 74b3683cf1 Protect against chat message spoofing. 2020-11-30 20:04:58 +01:00
Juliusz Chroboczek 6040d1943c Allow forwarding usermessages.
They now have the same format as chat messages; the only difference
is that they are not stored in the chat history.

Also adds userMessage method to ServerConnection.

Fix usermessages.
2020-11-30 14:39:36 +01:00
Juliusz Chroboczek 4c0fd01258 Implement hashed passwords. 2020-11-29 22:17:51 +01:00
Juliusz Chroboczek 1ed2540bd7 Don't send permissions with each client message.
Thanks to Antonin Décimo.
2020-11-29 15:46:22 +01:00
Juliusz Chroboczek 21361a87cd Fix kick message. 2020-11-25 00:16:32 +01:00
Juliusz Chroboczek 7ee8cbc45a Don't push incomplete connections.
If a connetion is slow to get established, this would cause it to
be pushed twice, the first time before it is complete.  Thanks to
Roman Koval who noticed the issue.
2020-11-05 20:48:07 +01:00
Juliusz Chroboczek 6c6b0b39c9 Copy id list in setRequested.
Probably not necessary, but I'm supersticious.
2020-10-27 18:24:33 +01:00
Juliusz Chroboczek 90ba4814c8 Discard old history entries. 2020-10-08 14:41:33 +02:00
Juliusz Chroboczek 0eb1593bb8 Delay adding tracks until connection is complete.
This avoids losing packets at the beginning of a connection.
2020-10-06 04:18:46 +02:00
Juliusz Chroboczek bda58b42c6 Rename disk to diskwriter. 2020-10-04 21:08:34 +02:00
Juliusz Chroboczek 66dd71678e Implement private messages. 2020-10-01 16:59:09 +02:00
Juliusz Chroboczek bd5cd7c1a2 Avoid calling pc.Close under a lock.
Apparently Close can take unbounded amounts of time.
2020-10-01 16:08:12 +02:00
Juliusz Chroboczek 13d6b7ad1f Don't disconnect clients when negotiation fails.
This may happen if we receive an answer for a connection that has been
closed in the meantime.
2020-10-01 15:35:35 +02:00
Juliusz Chroboczek 9ce591e4c5 Override permissions for disk recording. 2020-10-01 13:40:15 +02:00
Juliusz Chroboczek 3bd9a1db4e Timestamp chat messages. 2020-09-30 00:54:12 +02:00
Juliusz Chroboczek aeb8540ad4 Fix kickability. 2020-09-18 14:47:33 +02:00
Juliusz Chroboczek f8ae908d7a Implement message for locked groups. 2020-09-18 11:40:00 +02:00
Juliusz Chroboczek 2347417f83 Merge branch 'modular' into master 2020-09-18 10:33:17 +02:00
Juliusz Chroboczek 6f5ae12f14 Move RTP-specific code into its own package. 2020-09-18 10:28:05 +02:00
Renamed from webclient.go (Browse further)