8000 ClientContext (tcp) updates by d-a-v · Pull Request #5089 · esp8266/Arduino · GitHub
[go: up one dir, main page]

Skip to content

ClientContext (tcp) updates #5089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 39 commits into from
Sep 25, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
6c64759
wip
d-a-v Aug 22, 2018
746ec81
cc wip
d-a-v Aug 22, 2018
53c9222
cc wip
d-a-v Aug 22, 2018
6de50d4
cc comments
d-a-v Aug 22, 2018
2dd152d
wip cc
d-a-v Aug 24, 2018
f87602a
+sync, get/set default nodelay, sync
d-a-v Aug 27, 2018
6be4b6f
default nodelay=1
d-a-v Aug 28, 2018
8f7fb1e
update flush()
d-a-v Aug 28, 2018
c0bea2b
fix return value
d-a-v Aug 28, 2018
d00ac35
ClientContext: put things together
d-a-v Aug 28, 2018
53931c5
wip
d-a-v Aug 22, 2018
81ec0f4
cc wip
d-a-v Aug 22, 2018
fbf1dd1
cc wip
d-a-v Aug 22, 2018
b4a918f
cc comments
d-a-v Aug 22, 2018
c14eeef
wip cc
d-a-v Aug 24, 2018
238610e
+sync, get/set default nodelay, sync
d-a-v Aug 27, 2018
d0036a1
default nodelay=1
d-a-v Aug 28, 2018
e4c187b
update flush()
d-a-v Aug 28, 2018
d31d6f2
fix return value
d-a-v Aug 28, 2018
5cf60b6
ClientContext: put things together
d-a-v Aug 28, 2018
a058506
Move SSLContext to its own header (#5121)
earlephilhower Sep 17, 2018
a7a5959
Fix connection options and update github pubkey (#5120)
earlephilhower Sep 17, 2018
d06cac2
ClientContext: fix debugging messages
d-a-v Sep 18, 2018
e8c659e
Merge branch 'master' into ClientContext
earlephilhower Sep 18, 2018
f271b2a
WiFiClient: move static members out of the class, add comments
d-a-v Sep 18, 2018
7f57694
Merge branch 'ClientContext' of github.com:d-a-v/Arduino into ClientC…
d-a-v Sep 18, 2018
888bdb8
remove circular dependency
d-a-v Sep 19, 2018
c59a91f
parameter and return value for Client::flush&stop, flush timeout rais…
d-a-v Sep 22, 2018
3c54c9e
Merge branch 'master' into ClientContext
d-a-v Sep 23, 2018
8414e17
tcp flush: restart timer on ack receive
d-a-v Sep 23, 2018
4d62879
OTA protocol needs setNoDelay(true)
d-a-v Sep 23, 2018
826b8b5
fix Ethernet with Client changes
d-a-v Sep 23, 2018
3fa6a97
1 line unredable -> 5 lines readable code
d-a-v Sep 23, 2018
72b59d9
Merge branch 'master' into ClientContext
d-a-v Sep 24, 2018
7752c98
doc
d-a-v Sep 24, 2018
c160d17
doc
d-a-v Sep 24, 2018
db8fe6c
doc
d-a-v Sep 24, 2018
8bb444d
doc
d-a-v Sep 24, 2018
33dee32
Update client-class.rst
devyte Sep 24, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
remove circular dependency
  • Loading branch information
d-a-v committed Sep 19, 2018
commit 888bdb8c3b10b534e77495d3ea89396b04f8717c
27 changes: 15 additions & 12 deletions libraries/ESP8266WiFi/src/WiFiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,30 +42,33 @@ extern "C"
#include "c_types.h"

uint16_t WiFiClient::_localPort = 0;
bool WiFiClient::_defaultNoDelay = true;
bool WiFiClient::_defaultSync = false;

static bool _defaultNoDelay = false; // false == Nagle enabled by default
static bool _defaultSync = false;
static bool defaultNoDelay = false; // false == Nagle enabled by default
static bool defaultSync = false;

bool getDefaultPrivateGlobalSyncValue ()
{
return defaultSync;
}

void WiFiClient::setDefaultNoDelay (bool noDelay)
{
_defaultNoDelay = noDelay;
defaultNoDelay = noDelay;
}

void WiFiClient::setDefaultSync (bool sync)
{
_defaultSync = sync;
defaultSync = sync;
}

bool WiFiClient::getDefaultNoDelay ()
{
return _defaultNoDelay;
return defaultNoDelay;
}

bool WiFiClient::getDefaultSync ()
{
return _defaultSync;
return defaultSync;
}

template<>
Expand All @@ -86,8 +89,8 @@ WiFiClient::WiFiClient(ClientContext* client)
_client->ref();
WiFiClient::_add(this);

setSync(_defaultSync);
setNoDelay(_defaultNoDelay);
setSync(defaultSync);
setNoDelay(defaultNoDelay);
}

WiFiClient::~WiFiClient()
Expand Down Expand Up @@ -174,8 +177,8 @@ int WiFiClient::connect(IPAddress ip, uint16_t port)
return 0;
}

setSync(_defaultSync);
setNoDelay(_defaultNoDelay);
setSync(defaultSync);
setNoDelay(defaultNoDelay);

return 1;
}
Expand Down
3 changes: 0 additions & 3 deletions libraries/ESP8266WiFi/src/WiFiClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,6 @@ class WiFiClient : public Client, public SList<WiFiClient> {

ClientContext* _client;
static uint16_t _localPort;

static bool _defaultNoDelay;
static bool _defaultSync;
};

#endif
7 changes: 5 additions & 2 deletions libraries/ESP8266WiFi/src/include/ClientContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,14 @@ extern "C" void esp_schedule();

#include "DataSource.h"

bool getDefaultPrivateGlobalSyncValue ();

class ClientContext
{
public:
ClientContext(tcp_pcb* pcb, discard_cb_t discard_cb, void* discard_cb_arg) :
_pcb(pcb), _rx_buf(0), _rx_buf_offset(0), _discard_cb(discard_cb), _discard_cb_arg(discard_cb_arg), _refcnt(0), _next(0), _sync(WiFiClient::getDefaultSync())
_pcb(pcb), _rx_buf(0), _rx_buf_offset(0), _discard_cb(discard_cb), _discard_cb_arg(discard_cb_arg), _refcnt(0), _next(0),
_sync(::getDefaultPrivateGlobalSyncValue())
{
tcp_setprio(pcb, TCP_PRIO_MIN);
tcp_arg(pcb, this);
Expand Down Expand Up @@ -473,7 +476,7 @@ class ClientContext
// (with sync, we wait for acknowledgment before returning to user)
flags |= TCP_WRITE_FLAG_COPY;
err_t err = tcp_write(_pcb, buf, next_chunk_size, flags);
DEBUGV(":wrc %d %d %d\r\n", next_chunk_size, will_send, (int)err);
DEBUGV(":wrc %d %d %d\r\n", next_chunk_size, _datasource->available(), (int)err);
if (err == ERR_OK) {
_datasource->release_buffer(buf, next_chunk_size);
_written += next_chunk_size;
Expand Down
0