Skip to content
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

Add a Transport::TCP class for tcp-based communication. #2689

Merged
merged 46 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
a3ece7d
Add Disconnect call support in transport base and tuple, since connec…
andy31415 Sep 15, 2020
5a64e0f
Remove message send port from UDP - peer address already contains a port
andy31415 Sep 15, 2020
80c881b
Add tcp transport type to peer addresses
andy31415 Sep 15, 2020
aace8a8
Create a TCP header and cpp files that compile with gn. Not yet funct…
andy31415 Sep 15, 2020
1d6c6b9
Added TCP tests. They fail since no implementation available, however…
andy31415 Sep 15, 2020
57cdb9c
Started to rename more stuff from UDP to TCP in tests
andy31415 Sep 15, 2020
5c98783
Add a buffer of active connections within tcp connection. Use templat…
andy31415 Sep 15, 2020
4fefbb2
Added an array of "Pending packets" for the TCP interface
andy31415 Sep 15, 2020
a6c8f9e
Free pending packet buffers in the TCP destructor
andy31415 Sep 15, 2020
a46519e
Start adding ability to enqueu and start connections over TCP
andy31415 Sep 15, 2020
bc911d6
More work on connections
andy31415 Sep 15, 2020
443add7
Setup for data receive
andy31415 Sep 15, 2020
8e7f6ac
Setup for data receive
andy31415 Sep 15, 2020
be7ad2c
Seeing TCP data being received
andy31415 Sep 15, 2020
1a1425f
Prepare for message receiving. CHIPConnection logic can be used as a …
andy31415 Sep 16, 2020
ef4a42c
Added logic for message receiving and parsing
andy31415 Sep 16, 2020
10fc27e
Unit tests now pass, however connections are not properly closed yet
andy31415 Sep 16, 2020
3d7a4c7
Unit tests pass
andy31415 Sep 16, 2020
517235a
Add ability to close active connections and wait for them to actually…
andy31415 Sep 16, 2020
ed3cb92
Work towards being able to close active connections
andy31415 Sep 16, 2020
6b66de4
Add close notification handling and peer close callback
andy31415 Sep 16, 2020
8b9d993
One end of the connection now is cleared. Not both ends though, which…
andy31415 Sep 16, 2020
be3d830
Update accept error handling: nothing we can do except log
andy31415 Sep 16, 2020
0e4819f
Slight comment update
andy31415 Sep 16, 2020
628359f
Update comment on what causes time wait in connections. Frustrating, …
andy31415 Sep 16, 2020
14cdba1
Merge branch 'master' into 01_implement_tcp_transport
andy31415 Sep 16, 2020
53d8fd9
Use interface from the peer address rather than from the listen socket
andy31415 Sep 16, 2020
6278737
Add interface comparison logic into peer address objects
andy31415 Sep 16, 2020
9958256
Update typo for interface id
andy31415 Sep 16, 2020
e3662fb
GN format files
andy31415 Sep 16, 2020
975c34b
Update timeouts to 5s for TCP tests, hoping qemu tests fail because o…
andy31415 Sep 16, 2020
acabcc3
Update namespacing in unit tests
andy31415 Sep 16, 2020
7c019c7
Add TCP endpoint include - seems missing as nrf complains
andy31415 Sep 16, 2020
6086423
Add check for TCP endpoint to exist within the TCP transport. This if…
andy31415 Sep 16, 2020
65b37fd
Code review updates
andy31415 Sep 17, 2020
c67cb08
Fix typo
andy31415 Sep 17, 2020
8083d21
More code review updates: add a free on error and update file descrip…
andy31415 Sep 17, 2020
287b5cd
More code review updates: ensure endpoint count is updated, add log f…
andy31415 Sep 17, 2020
a8637f0
Update one more place for used endpoint count decreasing
andy31415 Sep 17, 2020
1b60cbc
Call disconnect on session expiry
andy31415 Sep 17, 2020
3b27f33
Updated comment regarding expiry. Expiry is especially critical for T…
andy31415 Sep 17, 2020
7f5dfa4
Fix typo
andy31415 Sep 17, 2020
ab3202a
Code review updates
andy31415 Sep 17, 2020
9d9e445
More comment updates
andy31415 Sep 17, 2020
73e12e8
More comment updates
andy31415 Sep 17, 2020
da64988
Make peer address equality strict on interface id
andy31415 Sep 17, 2020
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
Fix typo
  • Loading branch information
andy31415 committed Sep 17, 2020
commit c67cb08d83ca068a799d6e7baa8847bbf1039403
8 changes: 4 additions & 4 deletions src/transport/TCP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ CHIP_ERROR TCPBase::Init(TcpListenParameters & params)
mListenSocket->OnDataReceived = OnTcpReceive;
mListenSocket->OnConnectComplete = OnConnectionComplete;
mListenSocket->OnConnectionClosed = OnConnectionClosed;
mListenSocket->OnConnectionReceived = OnConnectionRecevied;
mListenSocket->OnConnectionReceived = OnConnectionReceived;
mListenSocket->OnAcceptError = OnAcceptError;
mEndpointType = params.GetAddressType();

Expand Down Expand Up @@ -282,7 +282,7 @@ CHIP_ERROR TCPBase::SendAfterConnect(const PeerAddress & addr, System::PacketBuf
endPoint->OnDataReceived = OnTcpReceive;
endPoint->OnConnectComplete = OnConnectionComplete;
endPoint->OnConnectionClosed = OnConnectionClosed;
endPoint->OnConnectionReceived = OnConnectionRecevied;
endPoint->OnConnectionReceived = OnConnectionReceived;
endPoint->OnAcceptError = OnAcceptError;
endPoint->OnPeerClose = OnPeerClosed;

Expand Down Expand Up @@ -504,7 +504,7 @@ void TCPBase::OnConnectionClosed(Inet::TCPEndPoint * endPoint, INET_ERROR err)
}
}

void TCPBase::OnConnectionRecevied(Inet::TCPEndPoint * listenEndPoint, Inet::TCPEndPoint * endPoint, const IPAddress & peerAddress,
void TCPBase::OnConnectionReceived(Inet::TCPEndPoint * listenEndPoint, Inet::TCPEndPoint * endPoint, const IPAddress & peerAddress,
uint16_t peerPort)
{
TCPBase * tcp = reinterpret_cast<TCPBase *>(listenEndPoint->AppState);
Expand All @@ -525,7 +525,7 @@ void TCPBase::OnConnectionRecevied(Inet::TCPEndPoint * listenEndPoint, Inet::TCP
endPoint->OnDataReceived = OnTcpReceive;
endPoint->OnConnectComplete = OnConnectionComplete;
endPoint->OnConnectionClosed = OnConnectionClosed;
endPoint->OnConnectionReceived = OnConnectionRecevied;
endPoint->OnConnectionReceived = OnConnectionReceived;
endPoint->OnAcceptError = OnAcceptError;
endPoint->OnPeerClose = OnPeerClosed;
}
Expand Down
2 changes: 1 addition & 1 deletion src/transport/TCP.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ class DLL_EXPORT TCPBase : public Base
static void OnPeerClosed(Inet::TCPEndPoint * endPoint);

// Callback handler for TCPEndPoint. Called when a connection is received on the listening port.
static void OnConnectionRecevied(Inet::TCPEndPoint * listenEndPoint, Inet::TCPEndPoint * endPoint,
static void OnConnectionReceived(Inet::TCPEndPoint * listenEndPoint, Inet::TCPEndPoint * endPoint,
const IPAddress & peerAddress, uint16_t peerPort);

// Called on accept error
Expand Down