Update File transfer
This commit is contained in:
parent
0f97ba4ca3
commit
1a1dfd26f0
|
@ -79,7 +79,13 @@ The following method is used:
|
|||
|
||||
##### Receiving a file
|
||||
|
||||
**TODO**
|
||||
|
||||
The same structure is used to receive files, but the method changes a bit:
|
||||
|
||||
1. The `JamiAccount` class is used to receives messages from the DHT, because the first thing received will be the DHT request.
|
||||
2. Then, this message is given to `DhtPeerConnector: onRequestMessage()` through the eventLoop.
|
||||
3. The `DhtPeerConnector::Impl::answerToRequest` will try to connect to the TURN server (if not connected) and initialize the ICE transport. This method open 2 control connections to a TURN server (one to authorize IPv4 peers, another one for IPv6 peers, due to **RFC 6156**) if it's not already open and permit Peer public addresses to connect. Then, if the SDP received doesn't contains ICE candidates, will use the TURN and craft the SDP answer to wait for the peer. If the SDP contains ICE candidates, the method will try to negotiate the link (or fallback on the TURN) and then answer the SDP (with ICE candidates or not).
|
||||
4. Once the links are ready, like the sender, a TLS link is negotiated and given to the `PeerConnection` given to the `IncomingFileTransfer` as an input. The headers of the file will come and the client is now able to accept or cancel the transfer.
|
||||
|
||||
##### Schema
|
||||
|
||||
|
@ -123,40 +129,6 @@ Note that the stack for the file transfer is:
|
|||
+----------------------------------------------------+
|
||||
```
|
||||
|
||||
|
||||
|
||||
#### Receiving files
|
||||
|
||||
1\. Because the sender will send a *PeerConnectionMsg* on the DHT, the
|
||||
first thing to do is to listen for incoming *PeerConnectionMsg*
|
||||
(messages will come on the hash **peer:device\_id**)
|
||||
|
||||
2\. When a message arrives,
|
||||
**DhtPeerConnector::Impl::onTrustedRequestMsg** is triggered. This
|
||||
method open 2 control connections to a TURN server (one to authorize
|
||||
IPv4 peers, another one for IPv6 peers, due to **RFC 6156**) if it's not
|
||||
already open and permit Peer public addresses to connect. 3. Then, it
|
||||
will send a response containing public ips where the peer should use to
|
||||
send the file on the DHT and waits for a connection from the other side.
|
||||
|
||||
4\. As soon as a peer is successfully connected,
|
||||
**DhtPeerConnector::Impl::onTurnPeerConnection** is called and the
|
||||
negotiation of a TLS over TURN session is launched. Then, a
|
||||
PeerConnection is created and attached to a local FTPServer (see
|
||||
**ftp\_server.h**) used to retrieve the file.
|
||||
|
||||
5\. The **PeerConnection::PeerConnectionImpl::eventLoop()** will detect
|
||||
that a new output stream is attached (the ftp\_server) and calls
|
||||
**FtpServer::write**. This method will retrieve headers of the incoming
|
||||
file and call **DataTransferFacade::onIncomingFileRequest**.
|
||||
|
||||
6\. **onIncomingFileRequest** will create a new *IncomingFile* and block
|
||||
the transfer until the client accepts this transfer (or refuse).
|
||||
|
||||
7\. As soon as the client accepts (or not) the transfer, the *FTPServer*
|
||||
sends "GO" (or "NGO"), retrieve the file until the file is finished, or
|
||||
canceled (by killing the connection)
|
||||
|
||||
### Multi devices
|
||||
|
||||
A RING user can link its account to several devices. So, we need to
|
||||
|
|
Loading…
Reference in New Issue