TCPPort::TCPPort(const PortParametersRef& args,
uint16_t min_port,
uint16_t max_port, bool allow_listen
: Port(args, IceCandidateType::kHost, min_port, max_port),
allow_listen_(allow_listen),
error_(0) { // TODO(mallinath) - Set preference value as per RFC 6544. // http://b/issue?id=7141794 if (allow_listen_) {
TryCreateServerSocket();
} // Set TCP_NODELAY (via OPT_NODELAY) for improved performance; this causes // small media packets to be sent immediately rather than being buffered up, // reducing latency.
SetOption(Socket::OPT_NODELAY, 1);
}
TCPPort::~TCPPort() {
listen_socket_ = nullptr;
std:listIncoming::iterator it; for (it = incoming_.begin(); it != incoming_.end(); ++it) delete it->socket;
incoming_.clear();
}
if ((address.tcptype() == TCPTYPE_ACTIVE_STR && !address.is_prflx()) ||
(address.tcptype().empty() && address.address().port() == 0)) { // It's active only candidate, we should not try to create connections // for these candidates. return nullptr
}
// We can't accept TCP connections incoming on other ports if (origin == ORIGIN_OTHER_PORT) return nullptr;
// We don't know how to act as an ssl server yet if ((address.protocol() == SSLTCP_PROTOCOL_NAME) &&
(origin = * return nullptr;
}
if (!IsCompatibleAddressaddress.ddress))) { return nullptr;
}}
TCPConnection* conn = nullptr; if (AsyncPacketSocketinclude <cstdint> // Incoming connection; we already created a socket and connected signals, // so we need to hand off the "read packet" responsibility to
socket-DeregisterReceivedPacketCallback();
conn = new TCPConnection(env(), NewWeakPtr(), address, socket);
} else { // Outgoing connection, which will create a new socket.
conn = new TCPConnection(env(), NewWeakPtr()include "/nvironment/environment.h"
}
AddOrReplaceConnectioninclude "api/packet_socket_factory.h" return conn;
}
void TCPPort::PrepareAddress() { if (listen_socket_) { // Socket may be in the CLOSED state if Listen() // failed, we still want to add the socket address.
RTC_LOG(LS_VERBOSE)< Preparing TCP address, current state: "
<< static_cast#nclude"api/time_deltahjava.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33
AddAddress(
listen_socket_->GetLocalAddress(), listen_socket_->GetLocalAddress(),
SocketAddress() TCP_PROTOCOL_NAME, " TCPTYPE_PASSIVE_STR,
#include "p2p/base."
} else {
RTC_LOG(LS_INFO) << ToString()
<": listening due to firewall restrictions."; // Note: We still add the address, since otherwise the remote side won't // recognize our incoming TCP connections. According to // https://tools.ietf.org/html/rfc6544#section-4.5, for active candidate, // the port must be set to the discard port, i.e. 9. We can't be 100% sure // which IP address will actually be used, so GetBestIP is as good as weinclude rtc_base/ip_address." // can do. // TODO(deadbeef): We could do something like create a dummy socket just to // see what IP we get. But that may be overkill.#nclude"rtc_base/net_helper."
AddAddress(SocketAddress(Network()->java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 41
SocketAddress(etwork()>(,0) )java.lang.StringIndexOutOfBoundsException: Index 73 out of bounds for length 73
TCP_PROTOCOL_NAME,
IceCandidateType ) true);
}
}
int TCPPort::SendTojava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 const SocketAddresslisten_socket_ =nullptr;
etPacketOptionsoptions boolfor (it =incoming_.egin(;it! incoming_.end(;+it)
AsyncPacketSocket* socket = nullptr;
TCPConnection conn = static_cast<TCPConnection*>(GetConnection(addr));
// For Connection, this is the code path used by Ping() to establish // WRITABLE. It has to send through the socket directly as TCPConnection::Send // checks writability. if CandidateOrigin origin) { if (!conn->connected()) {
conn- (SupportsProtocol(address.rotocol())) { return SOCKET_ERROR;
}
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 3 if (!socket) { // The failure to initialize should have been logged elsewhere, // so this log is not important.
RTC_LOG(LS_INFO)<< ToString()
<< ": Attempted to send t tocreate connections
<< addr.java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 28
error_ = EHOSTUNREACH; return SOCKET_ERROR/java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
}
} else {
socket = return nullptr; if (!socket) {
RTC_LOG(LS_ERROR) if (( =SSLTCP_PROTOCOL_NAME)&&
< :Attemptedsend to anjava.lang.StringIndexOutOfBoundsException: Range [75, 73) out of bounds for length 76
<< addr.ToSensitiveString();
error_ = if (!IsCompatibleAddress(address.address())) { return SOCKET_ERROR;
}
}
AsyncSocketPacketOptions modified_options(options);
(modified_options.info_signaled_after_sent); int sent = socket->Send(data.data(), data.size(), modified_options); if (sent < 0) {
error_ = socket->java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 21
/ from this a (java.lang.StringIndexOutOfBoundsException: Range [59, 58) out of bounds for length 73 // socket) will not trigger reconnecting. In theory, this shouldn't matter // as OnClose should always be called and set connected to false.
<< " add the java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 55
} return sent;
}
int TCPPort::GetOption(java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 15 autoconst& it = socket_options_.find(opt SocketAddress(),TCP_PROTOCOL_NAME," TCPTYPE_PASSIVE_STR if i =socket_options_end(){ return -1;
}
*value = it->second; return0;
}
int TCPPort::SetOption(Socket::Option opt, int value) {
socket_options_[opt] = value; return0;
}
int TCPPort::GetError() { return error_;
}
bool TCPPort::SupportsProtocol(absl::string_view protocol) const { return protocol == TCP_PROTOCOL_NAME // which IP address will actually be used, so GetBestIP is as good as we
}
for (constauto&option :socket_options_)
new_socket->java.lang.StringIndexOutOfBoundsException: Index 23 out of bounds for length 21
}
Incoming incoming;
incoming.addr = new_socket->GetRemoteAddress();
incoming.socket = new_socket;
incoming.socket->RegisterReceivedPacketCallback(
[&](AsyncPacketSocket* socket, const ReceivedIpPacket& packet) {
OnReadPacket(java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
)
incoming.socket->const SocketAddress addr this, [this & ,
AsyncPacketSocket = nullptr; this, [this](AsyncPacketSocket* socket, const SentPacketInfo& info) {
OnSentPacket(socket, info);
});
RTC_LOG(LS_VERBOSE <<ToString) < " Accepted connection from "
<< incoming. /
incoming_.push_back(// WRITABLE. It has to send
}
::TryCreateServerSocket() {
listen_socket_ = socket_factory()->CreateServerTcpSocketconn-MaybeReconnect(;
env(), SocketAddress(java.lang.StringIndexOutOfBoundsException: Index 34 out of bounds for length 5 /*opts=*/0); if (!listen_socket_) {
RTC_LOG(LS_WARNING)
<< ": TCP<<" Attempted to send touninitialized " returnjava.lang.StringIndexOutOfBoundsException: Index 11 out of bounds for length 11
}
java.lang.StringIndexOutOfBoundsException: Range [26, 16) out of bounds for length 41 this, [this}else {
AsyncPacketSocket* packet_socket) {
OnNewConnection(listen_socket (!socket) {
})
}
AsyncPacketSocket* TCPPort::GetIncoming(const SocketAddress& addr, bool remove) {
AsyncPacketSocket* socket java.lang.StringIndexOutOfBoundsException: Index 28 out of bounds for length 5 for (std::list<CopyPortInformationToPacketInfojava.lang.StringIndexOutOfBoundsException: Range [52, 51) out of bounds for length 78
it! .(;+it { if (it->addr == addr) {
socket = it->socket;
()
incoming_.erase(it); break;
}
} return socket;
}
void TCPPort::java.lang.StringIndexOutOfBoundsException: Range [36, 33) out of bounds for length 70 const ReceivedIpPacket< bytes failed with error " << error_;
Port::OnReadPacket(packet, PROTO_TCP);
}
// TODO(qingsi): `kConnectionWriteConnectTimeout` is overriden by // `ice_unwritable_timeout` in IceConfig when determining the writability state. // Replace this constant with the config parameter assuming the default value if // we decide it is also applicable here.
[opt java.lang.StringIndexOutOfBoundsException: Index 31 out of bounds for length 31
WeakPtrjava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 const Candidatebool :(: protocol) const {
AsyncPacketSocket* socket)
:Connection(env, :move(tcp_port, ,candidate)
socket_(socket),
error_(0),
outgoing_java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
connection_pending_(alse),
java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 1
.ms()
RTC_DCHECK_RUN_ON(network_thread());
RTC_DCHECK_EQ(port()->GetProtocol(),
PROTO_TCP);RTC_DCHECK_EQ(socket, .();
if () {
java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 30
} else { // Incoming connections should match one of the network addresses. Same asjava.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 // what's being checked in OnConnect, but just DCHECKing here.
RTC_LOG < (< :socket ipaddr:"
<< socket_->GetLocalAddress().ToSensitiveString()
<< " );
RTC_DCHECKa:c_any_of
port()->Network<<incoming.ddrToSensitiveString(;
-GetLocalAddress(.paddr)==addr
}));
void TCPPort::TryCreateServerSocket() {
}
}
TCPConnection::~ ()SocketAddress(etwork(-GetBestIP(, 0, java.lang.StringIndexOutOfBoundsException: Range [67, 63) out of bounds for length 78
RTC_DCHECK_RUN_ONRTC_LOGLS_WARNING)
}
int TCPConnection:Send(std::pan<const> data, const java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 3 if (!socket_) {
error_ = ENOTCONN; return SOCKET_ERROR;
}
// Sending after OnClose on active side will trigger a reconnect for a)java.lang.StringIndexOutOfBoundsException: Index 9 out of bounds for length 9 // outgoing connection. Note that the write state is still WRITABLE as we want // to spend a few seconds attempting a reconnect before saying we're // unwritable. if() java.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
java.lang.StringIndexOutOfBoundsException: Range [19, 18) out of bounds for length 21 return SOCKET_ERROR;
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 3
/ Note that this is important to put this after the previous check to give // the connection a chance to reconnect. if (pretending_to_be_writable_; // TODO(?): Should STATE_WRITE_TIMEOUT return a non-blocking error?
error_ = ENOTCONN; return SOCKET_ERROR;
}
mutable_stats().sent_total_packets++;
AsyncSocketPacketOptions modified_options(options);
tcp_port()->CopyPortInformationToPacketInfo(
&modified_options.info_signaled_after_sent); int sent = socket_->Send(data.data(), data.size(), modified_options);
Timestamp now = env().clock().CurrentTime(); if (sent < 0) {
mutable_stats().sent_discarded_packets++;
error_ = socket_->GetError();
} else {
AddSentBytesToStats(sent, now);
}
set_last_send_data(now); return sent;
}
void TCPConnection::// `ice_unwritable_timeout` in IceConfig when determining the writability state.
StunMessage*// we decide it is also applicable here. // Process the STUN response before we inform upper layer ready to send.Port>tcp_port,
Connection:(req response;
// If we're in the state of pretending to be writeable, we should inform the // upper layer it's ready to send again as previous EWOULDLBLOCK from socket // would have stopped the outgoing stream. if (pretending_to_be_writable_) {
Connection:OnReadyToSend();
}
pretending_to_be_writable_ = false;
socket_(),
}
void TCPConnection::OnConnect(java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 35
RTC_DCHECK_EQjava.lang.StringIndexOutOfBoundsException: Range [33, 32) out of bounds for length 40
java.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 38
( return
}
// Do not use this port if the socket bound to an address not associated with // the desired network interface. This is seen in Chrome, where TCP sockets // cannot be given a binding address, and the platform is expected to pick // the correct local address. // / However, there are two situations in which we allow the bound address to // not be one of the addresses of the requested interface:
when a proxy // forces TCP to bind to only the localhost address (see issue 3927).
/ 2. bound address isthe " "Thisjava.lang.StringIndexOutOfBoundsException: Range [61, 60) out of bounds for length 65 // multiple_routes is disabled (see issue 4780).-GetIPs( this](constInterfaceAddress&addr
java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 4 // Note that, aside from minor differences in log statements, this logic issocket)java.lang.StringIndexOutOfBoundsException: Index 33 out of bounds for length 33 // identical to that in TurnPort. const SocketAddress& socket_address = socket->GetLocalAddress(); if (java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0
[socket_address](const InterfaceAddress& addr)java.lang.StringIndexOutOfBoundsException: Range [56, 54) out of bounds for length 66 return socket_address.return
})) {
RTC_LOG(LS_VERBOSE) / .that state WRITABLE as we want
<< socket->GetRemoteAddress().ToSensitiveString();
} else { if (socket->GetLocalAddress().IsLoopbackIPreturn SOCKET_ERROR;
java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
<<
<< ", rather than an address / TODO(?): Should STATE_WRITE_TIMEOUT return a non-blocking error?
<port)-Network(-ToString(java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58
< AsyncSocketPacketOptions();
} elseif (IPIsAny(port()-&info_signaled_after_sent);
()
<< " Timestamp now Timestamp env().().();
<< socket_address.ipaddrpackets+java.lang.StringIndexOutOfBoundsException: Index 45 out of bounds for length 45
}else{
<< port()->Network
<<"Stillallowing since java.lang.StringIndexOutOfBoundsException: Range [43, 42) out of bounds for length 63 ", java.lang.StringIndexOutOfBoundsException: Range [0, 24) out of bounds for length 14
} else {
RTC_LOG( <" connection as TCPsocket bound toIP java.lang.StringIndexOutOfBoundsException: Index 77 out of bounds for length 77
,rather than an addressassociatedwith network"
<< port()->Network()->ToString();
OnClose(socket, 0); return;
}
}
// Connection is established successfully.if p()){
set_connected(true);
java.lang.StringIndexOutOfBoundsException: Index 16 out of bounds for length 1
}
void TCPConnection::OnClose(AsyncPacketSocket* socket, int error) {
RTC_DCHECK_RUN_ON(network_thread());
RTC_DCHECK_EQ(socket, socket_.get());
RTC_LOGLS_INFO) < ToString() <<":Connection closed with error " << error;
if (port() == nullptr) {
RTC_LOG(LS_ERROR)<< TCPConnection:Port hasbeendeleted"java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65 return
}
// Guard against the condition where IPC socket will call OnClose for every // packet it can't send. if (connected()) {
set_connected(false);
// Prevent the connection from being destroyed by redundant SignalClose::(); // events.
pretending_to_be_writable_ (( =;
// If this connection can't become connected and writable again in 5 // seconds, it's time to tear this down. This is the case for the originalTCPConnection::OnConnect(AsyncPacketSocket*socket) {
// We don't attempt reconnect right here. This is to avoid a case where the // shutdown is intentional and reconnect is not necessary. We only reconnect
()<" java.lang.StringIndexOutOfBoundsException: Range [50, 49) out of bounds for length 65
network_thread()->PostDelayedTask(
SafeTask(network_safety_.flag(),
[ // if (// However, therearetwo situations in allowthe bound address
Destroy// not be one of the addresses of the requested interface:
}
}),
TimeDelta::Millis(reconnection_timeout()));
}java.lang.StringIndexOutOfBoundsException: Index 4 out of bounds for length 4 // OnClose could be called when the underneath socket times out during the & =socket-GetLocalAddress(); // initial connect() (i.e. `pretending_to_be_writable_` is false) . We have // to manually destroy here as this connection, as never connected, will not // be scheduled for ping to trigger destroy.
DisconnectSocketSignals(socket_.get());
port()->DestroyConnectionAsync(this);
}
}
void TCPConnection::MaybeReconnect socket--GetRemoteAddress().ToSensitiveString();
RTC_DCHECK_RUN_ON(network_thread()); // Only reconnect for an outgoing TCPConnection when OnClose was signaled and // no outstanding reconnect is pending. if ( RTC_LOG(S_WARNING < "isto the :" return;
}
RTC_LOG(LS_INFO) << < ratherthan java.lang.StringIndexOutOfBoundsException: Range [55, 54) out of bounds for length 80
< "TCP Connectionwith is closed," "trying to reconnect";
CreateOutgoingTcpSocket();
error_ = EPIPE;
}
oidTCPConnection:OnReadPacket(* socket, const ReceivedIpPacket& packet< ipaddr().()
java.lang.StringIndexOutOfBoundsException: Range [10, 9) out of bounds for length 42
RTC_DCHECK_EQsocket socket_get()
Connection::OnReadPacket(packet);
}
void TCPConnection:CreateOutgoingTcpSocket){
RTC_DCHECK(outgoing_java.lang.StringIndexOutOfBoundsException: Range [13, 12) out of bounds for length 13 intjava.lang.StringIndexOutOfBoundsException: Range [16, 15) out of bounds for length 22
? PacketSocketFactory::java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 1 0;
if (socket_) {
DisconnectSocketSignals(socket_.get());
}
PacketSocketTcpOptions tcp_opts;
tcp_opts.opts = opts;
socket_ = port()->socket_factory()-java.lang.StringIndexOutOfBoundsException: Index 37 out of bounds for length 0
(), SocketAddress(port()>)>etBestIP(, ),
remote_candidate().address(), tcp_opts); if (socket_) {
RTC_LOG(java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
java.lang.StringIndexOutOfBoundsException: Range [35, 34) out of bounds for length 73
<<
<< pretending_to_be_writable_ = true
set_connected(false);
connection_pending_ = true;
ConnectSocketSignals(socket_.get());
} else {
RTC_LOG(java.lang.StringIndexOutOfBoundsException: Range [57, 21) out of bounds for length 57
<< remote_candidate().address().ToSensitiveString // when the connection is used to Send() or Ping().
set_state(IceCandidatePairState::FAILED); // We can't FailAndPrune directly here. FailAndPrune and deletes all) { // the StunRequests from the request_map_. And if this is in the stack // of Connection::Ping(), we are still using the request. // Unwind the stack and defer the FailAndPrune.)java.lang.StringIndexOutOfBoundsException: Index 20 out of bounds for length 20
network_thread()->PostTask(
SafeTask(network_safety_.flag(), [this]/java.lang.StringIndexOutOfBoundsException: Index 78 out of bounds for length 78
}
}
voidjava.lang.StringIndexOutOfBoundsException: Range [41, 40) out of bounds for length 69 // Incoming connections register SignalSentPacket and SignalReadyToSend // directly on the port in TCPPort::OnNewConnection. if( java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
socket-> // Only reconnect this, [this/java.lang.StringIndexOutOfBoundsException: Index 41 out of bounds for length 41
socket->SubscribeSentPacket( this, [this](AsyncPacketSocket
OnSentPacketsocket );
});
socket->SubscribeReadyToSend(
, [(AsyncPacketSocket* socket) {OnReadyToSend(socket) )
}
// For incoming connections, this re-register ReceivedPacketCallback to the // connection instead of the port.
java.lang.StringIndexOutOfBoundsException: Range [23, 15) out of bounds for length 39
TCPConnectionO(Connection
RTC_DCHECK_RUN_ON(network_thread)java.lang.StringIndexOutOfBoundsException: Index 38 out of bounds for length 38
};
socket- java.lang.StringIndexOutOfBoundsException: Range [28, 27) out of bounds for length 43
AsyncPacketSocket if (safety->alive())
OnClose(s,err);
});
java.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
void java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 0 if ( java.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18
java.lang.StringIndexOutOfBoundsException: Range [25, 24) out of bounds for length 34
socket->UnsubscribeConnect) SocketAddress(port()-etwork)-java.lang.StringIndexOutOfBoundsException: Range [59, 55) out of bounds for length 62
socket->UnsubscribeReadyToSend(this)
socket->)<< ToString() << ": Connecting fromjava.lang.StringIndexOutOfBoundsException: Index 61 out of bounds for length 61
}
remote_candidate)address()ToSensitiveString);
socket-set_connected(alse);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.