зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1569183: Simplify how NrSockets specify whether they're proxied or not. r=mjf
Differential Revision: https://phabricator.services.mozilla.com/D46032 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
abf0777414
Коммит
72bcc87880
|
@ -123,8 +123,6 @@ class NrSocketBase {
|
|||
virtual int listen(int backlog) = 0;
|
||||
virtual int accept(nr_transport_addr* addrp, nr_socket** sockp) = 0;
|
||||
|
||||
virtual bool IsProxied() const = 0;
|
||||
|
||||
// Implementations of the async_event APIs
|
||||
virtual int async_wait(int how, NR_async_cb cb, void* cb_arg, char* function,
|
||||
int line);
|
||||
|
@ -187,8 +185,6 @@ class NrSocket : public NrSocketBase, public nsASocketHandler {
|
|||
virtual int listen(int backlog) override;
|
||||
virtual int accept(nr_transport_addr* addrp, nr_socket** sockp) override;
|
||||
|
||||
virtual bool IsProxied() const override { return false; }
|
||||
|
||||
protected:
|
||||
virtual ~NrSocket() {
|
||||
if (fd_) PR_Close(fd_);
|
||||
|
@ -267,8 +263,6 @@ class NrUdpSocketIpc : public NrSocketIpc {
|
|||
virtual int listen(int backlog) override;
|
||||
virtual int accept(nr_transport_addr* addrp, nr_socket** sockp) override;
|
||||
|
||||
virtual bool IsProxied() const override { return false; }
|
||||
|
||||
private:
|
||||
virtual ~NrUdpSocketIpc();
|
||||
|
||||
|
|
|
@ -248,7 +248,9 @@ void NrTcpSocket::OnClose(nsresult aReason) {
|
|||
|
||||
void NrTcpSocket::OnConnected(const nsCString& aProxyType) {
|
||||
r_log(LOG_GENERIC, LOG_DEBUG, "NrTcpSocket::OnConnected %p\n", this);
|
||||
mProxyType = aProxyType;
|
||||
if (aProxyType != "" && aProxyType != "direct") {
|
||||
my_addr_.is_proxied = true;
|
||||
}
|
||||
|
||||
DoCallbacks();
|
||||
}
|
||||
|
|
|
@ -86,10 +86,6 @@ class NrTcpSocket : public NrSocketBase, public WebrtcTCPSocketCallback {
|
|||
int listen(int aBacklog) override;
|
||||
int accept(nr_transport_addr* aAddr, nr_socket** aSocket) override;
|
||||
|
||||
bool IsProxied() const override {
|
||||
return mProxyType != "" && mProxyType != "direct";
|
||||
}
|
||||
|
||||
// WebrtcTCPSocketCallback
|
||||
void OnClose(nsresult aReason) override;
|
||||
void OnConnected(const nsCString& aProxyType) override;
|
||||
|
@ -109,7 +105,6 @@ class NrTcpSocket : public NrSocketBase, public WebrtcTCPSocketCallback {
|
|||
bool mClosed;
|
||||
|
||||
size_t mReadOffset;
|
||||
nsCString mProxyType;
|
||||
std::list<NrTcpSocketData> mReadQueue;
|
||||
|
||||
std::shared_ptr<NrSocketProxyConfig> mConfig;
|
||||
|
|
|
@ -1095,10 +1095,6 @@ int nr_socket_local_create(void* obj, nr_transport_addr* addr,
|
|||
if (r) {
|
||||
ABORT(r);
|
||||
}
|
||||
// TODO(bug 1569183): This will start out false, and may become true once the
|
||||
// socket class figures out whether a proxy needs to be used (this may be as
|
||||
// late as when it establishes a connection).
|
||||
addr->is_proxied = sock->IsProxied();
|
||||
|
||||
r = nr_socket_create_int(static_cast<void*>(sock), sock->vtbl(), sockp);
|
||||
if (r) ABORT(r);
|
||||
|
|
|
@ -91,8 +91,6 @@ class DummySocket : public NrSocketBase {
|
|||
return 0;
|
||||
}
|
||||
|
||||
virtual bool IsProxied() const override { return false; }
|
||||
|
||||
virtual int write(const void* msg, size_t len, size_t* written) override {
|
||||
size_t to_write = std::min(len, writable_);
|
||||
|
||||
|
|
|
@ -282,17 +282,6 @@ int TestNrSocket::accept(nr_transport_addr* addrp, nr_socket** sockp) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool TestNrSocket::IsProxied() const {
|
||||
if (internal_socket_->my_addr().protocol == IPPROTO_UDP ||
|
||||
port_mappings_.empty()) {
|
||||
// UDP and the no-nat case
|
||||
return internal_socket_->IsProxied();
|
||||
}
|
||||
// This is TCP only
|
||||
MOZ_ASSERT(port_mappings_.size() == 1);
|
||||
return port_mappings_.front()->external_socket_->IsProxied();
|
||||
}
|
||||
|
||||
void TestNrSocket::process_delayed_cb(NR_SOCKET s, int how, void* cb_arg) {
|
||||
DeferredPacket* op = static_cast<DeferredPacket*>(cb_arg);
|
||||
op->socket_->timer_handle_ = nullptr;
|
||||
|
|
|
@ -225,7 +225,6 @@ class TestNrSocket : public NrSocketBase {
|
|||
|
||||
int listen(int backlog) override;
|
||||
int accept(nr_transport_addr* addrp, nr_socket** sockp) override;
|
||||
bool IsProxied() const override;
|
||||
int async_wait(int how, NR_async_cb cb, void* cb_arg, char* function,
|
||||
int line) override;
|
||||
int cancel(int how) override;
|
||||
|
|
Загрузка…
Ссылка в новой задаче