Wraps communication between the local and remote computer, handled by one or more Connection objects. It monitors these connections and acts as the intermediary for peer to peer data between Transport and the Connection object. Call SendPacket to send data, and connect to SignalReadPacket to read incoming data. P2PTransport creates this channel at the request of the Session object. See Transports, Channels, and Connections for more information.
These methods are not thread-safe. Any method that does not have a calling thread specified can be called from any thread.
class P2PTransportChannel : public TransportChannelImp
public talk_base::MessageHandler
The following table lists the public methods of P2PTransportChannel.
| Name | Description |
|---|---|
| ~P2PTransportChannel | Destructor. Deletes references to all PortAllocatorSession objects that it holds. |
| bool writable() | Indicates whether the channel is currently writable. This method must be called from the worker thread. |
| Connection* best_connection() | Retrieves the best connection for this channel, as determined by preference and writability. |
| const std::vector<Connection*> connections() | Retrieves a list of Connection objects managed by this object. |
| int GetError() | Retrieves the last error that the channel had. |
| int SendPacket(const char *data, size_t len) | Sends data of size len bytes to the connected computer over the best connection. |
| int SetOption(Socket::Option opt, int value) | Sets various sending optionsl. Currently, the only values are as follows:
|
| P2PTransportChannel(const std::string &name, const std::string &session_type, P2PTransport* transport, PortAllocator *allocator); |
Constructor. This object must be created in the worker thread.
|
| std::string& name() | A unique name associated with this channel, created inside the code. This name is used to differentiate between multiple channels in the same Transport. |
| Transport* GetTransport() | Returns the Transport object that manages this channel. |
| void Connect() | Begins the process of attempting to make a connection to the other client. |
| void OnChannelMessage(const buzz::XmlElement* msg) | Received an incoming message. Typically the incoming message is a candidate message describing the remote candidate, which triggers P2PTransportChannel to create connections to the remote candidate. |
| void OnMessage(Message *pmsg) | The listener for multithreaded requests. |
| void OnSignalingReady() | Called by SocketManager to indicate that the signaling thread is ready. |
| void Reset() | Resets the object to the same state it had after the constructor was called. This method must be called from the worker thread. |
Attributes: public
Declaration file: talk/p2p/base/p2ptransportchannel.h