MCPcopy Create free account
hub / github.com/BruceDevices/firmware / relayLoop

Function relayLoop

src/modules/wifi/socks4_proxy.cpp:25–40  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23static const unsigned long RELAY_POLL_MS = 10;
24
25static void relayLoop(WiFiClient &client, WiFiClient &target) {
26 uint8_t buf[RELAY_BUF_SIZE];
27 while (client.connected() && target.connected()) {
28 if (check(EscPress)) break;
29 int n = 0;
30 if (client.available()) {
31 n = client.read(buf, sizeof(buf));
32 if (n > 0) target.write(buf, (size_t)n);
33 }
34 if (target.available()) {
35 n = target.read(buf, sizeof(buf));
36 if (n > 0) client.write(buf, (size_t)n);
37 }
38 if (n <= 0) delay(RELAY_POLL_MS);
39 }
40}
41
42static bool readSocks4Request(
43 WiFiClient &client, uint8_t &cd, uint16_t &dstPort, uint8_t dstIp[4], char *hostname, size_t hostnameSize

Callers 1

socks4ProxyFunction · 0.85

Calls 5

checkFunction · 0.85
connectedMethod · 0.80
availableMethod · 0.45
readMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected