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

Start TCP server after an SDP request is received. #199

Merged
merged 3 commits into from
Feb 21, 2023

Conversation

shalinnijel2
Copy link
Contributor

@shalinnijel2 shalinnijel2 commented Feb 16, 2023

Summary of changes:

  1. When iso15118 starts up only UDP server is started.
  2. When an SDP request is received, depending on the security setting in the request, either a TCP or TLS server is started. If TLS is requested, but a TLS server can't be started (maybe seccLeaf/cpoCertChain are not available), a TCP server is started - the SDP response reflects the type of TCP server available.
  3. Once the first message is received over TCP connection, UDP server if paused.
  4. At the end of the session, TCP server is killed and UDP resumes listening for SDP requests.

One minor change V2GCommunicationSession - we were relying on self.writer.get_extra_info('peername') to get the ip address of the remote connection - this is used as a key in self.comm_sessions dictionary. However, when the connection is reset, self.writer.get_extra_info('peername') would return None and any look up in the dictionary would fail. The call has been replaced with a member variable that holds the value (populated when the peer connection is available).

@shalinnijel2 shalinnijel2 requested a review from tropxy February 16, 2023 18:24
iso15118/secc/comm_session_handler.py Show resolved Hide resolved
self.tcp_server_handler = None
self.udp_server.resume_udp_server()

async def start_tcp_server(self, tls_enabled: bool):
Copy link
Contributor

Choose a reason for hiding this comment

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

can you change the flag name tls_enabled to with_tls ? makes more sense I think

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@shalinnijel2 shalinnijel2 marked this pull request as ready for review February 20, 2023 17:58
@shalinnijel2 shalinnijel2 merged commit 69bd83f into master Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants