Skip to content

TCP transport#251

Merged
richiware merged 346 commits intodevelopfrom
feature/tcp-transport
Oct 11, 2018
Merged

TCP transport#251
richiware merged 346 commits intodevelopfrom
feature/tcp-transport

Conversation

@JuanCarlos-Arce
Copy link
Copy Markdown
Contributor

Implementation of a new transport layer to manage TCP communication. These new transports are connection oriented, and they manage internally the negotiation and the reconnection if the communication is lost. The transport layer has been restructured to fit with the needs of the TCP communication and to ease the management of the sockets.

This feature includes:

  • New TCPv4Transport and TCPv6Transport classes.
  • New TransportInterface class that unifies the common code of the transports.
  • Create UDPSocketInfo and TCPSocketInfo to encapsulate the management of the sockets and their resources.
  • Create a new project "HelloWorldExampleTCP"
  • Remove the attribute "DefaultSendPort" from participants.

@richiware richiware changed the title Feature/tcp transport TCP transport Sep 3, 2018
@MiguelCompany MiguelCompany added enhancement needs-review PR that is ready to be reviewed labels Sep 4, 2018
@richiware richiware changed the title TCP transport TCP transport (#3) Sep 6, 2018
@richiware richiware changed the title TCP transport (#3) TCP transport Sep 6, 2018
Copy link
Copy Markdown
Member

@MiguelCompany MiguelCompany left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial review: examples and include was covered.

General feedback

  • Some files contain TAB characters. We use 4 spaces for indentation.
  • Some files on the examples seem to have been generated with an old version of fastrtpsgen. Please fix this

Design feedback
It seems the transport layer is using information from the upper layer (participant guid is passed to the transport layer, ReceiverResource is processing messages). This should not be the case. I understand that on TCP we can receive an RTPSMessage that should be sent to several participants. On UDP was easy, as multiple sockets can be listening on the same port, and all of them will receive a copy of the message. I understand that we may need a way to pass the received message to several entities of the uper layer, but that sould be done without knowledge of the content of the messages.


In the first one launch: 'BenchMark publisher tcp' or 'BenchMark publisher udp' (or HelloWorldExample.exe publisher on windows).
In the second one: 'HelloWorldExample subscriber tcp' or 'HelloWorldExample subscriber udp'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems you forgot to change some HelloWorldExample to BenchMark

using std::cout;
using std::endl;

/*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose this is to remove the 'unused variable' warning. I think it's better to remove the code completely.

//CREATE RTPSParticipant
ParticipantAttributes PParam;
PParam.rtps.defaultSendPort = 10042;
//PParam.rtps.defaultSendPort = 10042; // TODO Create transport?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As defaultSendPort is being removed, and I don't like TODOs on examples, please remove the whole line

//CREATE RTPSParticipant
ParticipantAttributes PParam;
PParam.rtps.defaultSendPort = 10042;
//PParam.rtps.defaultSendPort = 10042; // TODO Create transport?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As defaultSendPort is being removed, and I don't like TODOs on examples, please remove the whole line

}

void HelloWorldPublisher::run(uint32_t samples)
void HelloWorldPublisher::runThread(uint32_t samples, uint32_t sleep)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we complicating the most basic example with the creation of an additional thread?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This additional thread allows to stop the publisher pressing enter. This is useful when HelloWorldExample is executed as publisher without a limit of samples.

namespace fastrtps{
namespace rtps{

class RTPSWriter;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this class should have knowledge of the upper layer. If we need to pass a received message to several entities, we may register more than one MessageReceiver on the same ReceiverResource.

namespace fastrtps{
namespace rtps{

class RTPSParticipantImpl;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SenderResource should only know about locators and data, not about participants and guids

namespace fastrtps{
namespace rtps{

class ChannelResource
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The purpose of this class should be documented

// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef CHANNEL_RESOURCE_INFO_
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Define doesn't match filename

protected:

uint32_t maxMessageSize;
//! Participant GUID prefix.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should a transport need the GUID prefix?

@MiguelCompany MiguelCompany force-pushed the feature/tcp-transport branch from dd7e6b9 to 34630fd Compare October 1, 2018 11:24
Juan Carlos Arceredillo and others added 19 commits October 1, 2018 16:23
- Update TCP transport to fix an issue opening output channels over an input socket.
…s union types yet.

OpenLogicalPort negociation seems to work fine, redirection maybe not.
…r Android Devices.

- Update project configuration to build fastrtps with fastcdr in Windows
break;
case LOCATOR_KIND_TCPv4:
case LOCATOR_KIND_TCPv6:
//TODO: Check Physical <-> Logical Port
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this TODO means?

#define LOCATOR_KIND_TCPv4 4
#define LOCATOR_KIND_TCPv6 8

// TODO Make this class a base class for each kind of locator?
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What this TODO means?

m_att.port.offsetd3 +
m_att.port.participantIDGain*m_att.participantID), true);
}
if (loc.get_physical_port() == 0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if can be true when transport is UDP and change the value of the port, which was set already before.

@richiware richiware merged commit cf247a5 into develop Oct 11, 2018
@richiware richiware deleted the feature/tcp-transport branch October 11, 2018 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement needs-review PR that is ready to be reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants