-
Notifications
You must be signed in to change notification settings - Fork 429
Iox #27 client port implementation and test part 2 #863
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
Changes from 5 commits
3140e35
07c0aa9
d5d666f
3e0a2f0
d16c368
ed4c7a9
23b1188
d1e8770
41ba185
26c3695
de1efff
2c54884
a2d4b10
2c21ef3
eeebd96
242dfca
e6ef2fe
9516bfc
818a4a5
20e34c9
58b1474
9317487
a2e43ba
c3710a1
86d7010
64107a1
91db7a4
5b0cd5b
44d3f64
2af5101
41885ec
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@startuml | ||
|
||
== Client tries to connect (Server not present) == | ||
|
||
PortManager -> ClientPortRouDi ++ : tryGetCaProMessage | ||
return CaproMessageType::CONNECT | ||
|
||
PortManager -> PortManager ++ : sendToAllMatchingServerPorts | ||
|
||
PortManager -> ClientPortRouDi ++ : dispatchCaProMessageAndGetPossibleResponse(CaproMessageType::NACK) | ||
return cxx::nullopt | ||
|
||
return | ||
|
||
... | ||
|
||
== Server offers service (Client not present) == | ||
|
||
PortManager -> ServerPortRouDi ++ : tryGetCaProMessage | ||
return CaproMessageType::OFFER | ||
|
||
PortManager -> PortManager ++ : sendToAllMatchingClientPorts | ||
|
||
return | ||
|
||
... | ||
|
||
== Client tries to connect (Server preset) == | ||
|
||
PortManager -> ClientPortRouDi ++ : tryGetCaProMessage | ||
return CaproMessageType::CONNECT | ||
|
||
PortManager -> PortManager ++ : sendToAllMatchingServerPorts | ||
|
||
PortManager -> ServerPortRouDi ++ : dispatchCaProMessageAndGetPossibleResponse(CaproMessageType::CONNECT) | ||
return CaproMessageType::OFFER | ||
|
||
PortManager -> ClientPortRouDi ++ : dispatchCaProMessageAndGetPossibleResponse(CaproMessageType::OFFER) | ||
return CaproMessageType::HANDSHAKE | ||
|
||
PortManager -> ServerPortRouDi ++ : dispatchCaProMessageAndGetPossibleResponse(CaproMessageType::HANDSHAKE) | ||
return CaproMessageType::ACK | ||
|
||
PortManager -> ClientPortRouDi ++ : dispatchCaProMessageAndGetPossibleResponse(CaproMessageType::ACK) | ||
return cxx::nullopt | ||
|
||
return | ||
|
||
... | ||
|
||
== Server offers service (Client present) == | ||
|
||
PortManager -> ServerPortRouDi ++ : tryGetCaProMessage | ||
return CaproMessageType::OFFER | ||
|
||
PortManager -> PortManager ++ : sendToAllMatchingClientPorts | ||
|
||
PortManager -> ClientPortRouDi ++ : dispatchCaProMessageAndGetPossibleResponse(CaproMessageType::OFFER) | ||
return CaproMessageType::HANDSHAKE | ||
|
||
PortManager -> ServerPortRouDi ++ : dispatchCaProMessageAndGetPossibleResponse(CaproMessageType::HANDSHAKE) | ||
return CaproMessageType::ACK | ||
|
||
PortManager -> ClientPortRouDi ++ : dispatchCaProMessageAndGetPossibleResponse(CaproMessageType::ACK) | ||
return cxx::nullopt | ||
|
||
return | ||
|
||
... | ||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
@startuml | ||
|
||
[*] -down-> NOT_CONNECTED | ||
|
||
NOT_CONNECTED -left-> NOT_CONNECTED : OFFER | ||
NOT_CONNECTED -right-> CONNECT_REQUESTED : CONNECT | ||
elBoberido marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
CONNECT_REQUESTED -left-> NOT_CONNECTED : DISCONNECT | ||
CONNECT_REQUESTED -right-> CONNECT_REQUESTED : NACK | ||
CONNECT_REQUESTED -down-> CONNECT_HANDSHAKE : OFFER | ||
|
||
CONNECT_HANDSHAKE -left-> CONNECTED : ACK | ||
CONNECT_HANDSHAKE -up-> CONNECT_REQUESTED : NACK | ||
|
||
CONNECTED -up-> DISCONNECT_REQUESTED : DISCONNECT | ||
CONNECTED -up-> CONNECT_REQUESTED : STOP_OFFER | ||
|
||
DISCONNECT_REQUESTED -up--> NOT_CONNECTED : ACK/NACK | ||
|
||
@enduml |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -110,6 +110,21 @@ A client can ask a server to block if its response queue is full. | |
The server will obey if the corresponding `clientTooSlowPolicy` is set to `ConsumerTooSlowPolicy::WAIT_FOR_CONSUMER`. | ||
If the options don't match, the client will not be connected to the server, similar to the behavior of publisher and subscriber. | ||
|
||
#### Client Service Discovery | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To view this with rendered diagrams use the three dots on the right and select |
||
|
||
The client is guided by the following state machine. | ||
|
||
 | ||
|
||
Contrary to the subscriber state machine, the client doesn't pass it's response queue with the `CONNECT` CaPro message but with the `HANDSHAKE` message. | ||
The server will pass its request queue with the `OFFER` CaPro message. | ||
This is done to have the same state transitions for the case when the server is already present | ||
as well as when the server offers its service after the client initially tried to connect. | ||
|
||
Following is a sequence diagram which shows all this cases | ||
|
||
 | ||
|
||
### Code example | ||
|
||
## Open issues | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Copyright (c) 2021 by Apex.AI Inc. All rights reserved. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
namespace iox | ||
{ | ||
namespace capro | ||
{ | ||
inline constexpr const char* caproMessageTypeString(CaproMessageType messageType) noexcept | ||
{ | ||
switch (messageType) | ||
{ | ||
case CaproMessageType::NOTYPE: | ||
return "NOTYPE"; | ||
case CaproMessageType::FIND: | ||
return "FIND"; | ||
case CaproMessageType::OFFER: | ||
return "OFFER"; | ||
case CaproMessageType::STOP_OFFER: | ||
return "STOP_OFFER"; | ||
case CaproMessageType::SUB: | ||
return "SUB"; | ||
case CaproMessageType::UNSUB: | ||
return "UNSUB"; | ||
case CaproMessageType::CONNECT: | ||
return "CONNECT"; | ||
case CaproMessageType::DISCONNECT: | ||
return "DISCONNECT"; | ||
case CaproMessageType::HANDSHAKE: | ||
return "HANDSHAKE"; | ||
case CaproMessageType::ACK: | ||
return "ACK"; | ||
case CaproMessageType::NACK: | ||
return "NACK"; | ||
case CaproMessageType::PUB: | ||
return "PUB"; | ||
case CaproMessageType::REQ: | ||
return "REQ"; | ||
case CaproMessageType::RES: | ||
return "RES"; | ||
case CaproMessageType::PING: | ||
return "PING"; | ||
case CaproMessageType::PONG: | ||
return "PONG"; | ||
case CaproMessageType::MESSGAGE_TYPE_END: | ||
elBoberido marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return "MESSGAGE_TYPE_END"; | ||
} | ||
|
||
return "UNKNOWN_TYPE"; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please move this into the switch case as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moving this into default would mean we might miss a new message added to the enum. Without a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, can you please double check the Axivion scan with our custom AUTOSAR ruleset? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ahem, let's assume I'm a new contributor ... how would I do that? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can find the config files with all the rules in here There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @mossmaurice according to dkroenke the dashboard currently only works with the master branch. We currently use this pattern (no default but return statement) in several places already, e.g. https://github.com/eclipse-iceoryx/iceoryx/blob/master/iceoryx_posh/source/popo/trigger.cpp#L32-L41. Assuming our current rule set doesn't allow this, we need to change it anyway since it doesn't make sense and results in bad code where errors need to be catched by tests instead of the compiler. |
||
} | ||
|
||
} // namespace capro | ||
} // namespace iox |
Uh oh!
There was an error while loading. Please reload this page.