mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-19 00:11:02 +00:00
Add awful hack to work around very buggy android port forwarding
This commit is contained in:
@@ -23,11 +23,26 @@
|
||||
******************************************************************************/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#include <unistd.h>
|
||||
#include "os/os_specific.h"
|
||||
#include "os/posix/posix_network.h"
|
||||
|
||||
namespace Network
|
||||
{
|
||||
void SocketPostSend()
|
||||
{
|
||||
// we need to throttle android sending to ensure it never gets ahead of the PC otherwise the
|
||||
// forwarded port may encounter a EWOULDBLOCK error.
|
||||
// adb is buggy and will scompletely drop all writes as soon as a write blocks:
|
||||
// https://issuetracker.google.com/issues/139078301
|
||||
//
|
||||
// Throttling the device end is a hack but is reasonably reliable as we assume the PC side is fast
|
||||
// enough to read it. Since we batch most sends, sleeping on each send is not too costly, but this
|
||||
// may have some impact especially around small packets (we force a flush on the end of each
|
||||
// chunk/packet).
|
||||
usleep(1500);
|
||||
}
|
||||
|
||||
uint32_t Socket::GetRemoteIP() const
|
||||
{
|
||||
// Android uses abstract sockets which are only "localhost" accessible
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
|
||||
namespace Network
|
||||
{
|
||||
void SocketPostSend()
|
||||
{
|
||||
// only needed for awful hack on Android
|
||||
}
|
||||
|
||||
uint32_t Socket::GetRemoteIP() const
|
||||
{
|
||||
return GetIPFromTCPSocket((int)socket);
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
|
||||
namespace Network
|
||||
{
|
||||
void SocketPostSend()
|
||||
{
|
||||
// only needed for awful hack on Android
|
||||
}
|
||||
|
||||
uint32_t Socket::GetRemoteIP() const
|
||||
{
|
||||
return GetIPFromTCPSocket((int)socket);
|
||||
|
||||
@@ -27,6 +27,11 @@
|
||||
|
||||
namespace Network
|
||||
{
|
||||
void SocketPostSend()
|
||||
{
|
||||
// only needed for awful hack on Android
|
||||
}
|
||||
|
||||
uint32_t Socket::GetRemoteIP() const
|
||||
{
|
||||
return GetIPFromTCPSocket((int)socket);
|
||||
|
||||
@@ -70,6 +70,8 @@ static std::string errno_string(int err)
|
||||
|
||||
namespace Network
|
||||
{
|
||||
void SocketPostSend();
|
||||
|
||||
void Init()
|
||||
{
|
||||
}
|
||||
@@ -190,6 +192,9 @@ bool Socket::SendDataBlocking(const void *buf, uint32_t length)
|
||||
|
||||
RDCASSERT(sent == length);
|
||||
|
||||
// incredibly ugly hack necessary for android
|
||||
SocketPostSend();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user