-
Notifications
You must be signed in to change notification settings - Fork 246
Support TCP for protocol messages #3636
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
Draft
softins
wants to merge
18
commits into
jamulussoftware:main
Choose a base branch
from
softins:tcp-protocol
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,530
−88
Draft
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
c719f60
Add TCP handling for Server and Client
softins 08e68fc
Add some debug messages
softins 3768438
Some fixes recommended by AI review
softins 6b9c722
Use separate TCP sockets for IPv4 and IPv6
softins 2f31e10
Add a channel token for use by server channels.
softins d47e74f
Use channel token to authenticate a long TCP connection
softins 966a4ed
Add operator!= for CHostAddress for completeness
softins 2569c47
Check that CLM_TCP_SUPPORTED for client ID comes from the connected s…
softins fb997be
Only offer TCP mode if the listener started ok
softins dfbba54
Handle unlikely situation where new TCP connection replaces old
softins 05b3336
Log Error or EOF from TCP socket read
softins 94bfbdc
Update docs/TCP.md to include the channel token for TCP session authe…
softins ce65002
Minor change to OnReadyRead()
softins 9c07b62
Empty pending hashes when opening connect dialog
softins 2de9958
Minor updates from review
softins 0e3e1ff
Do not log the channel token
softins 558e355
Improvements from AI review
softins 078d1eb
Change "TCP supported" to "TCP offered"
softins File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -48,6 +48,7 @@ | |
|
|
||
| // CChannel implementation ***************************************************** | ||
| CChannel::CChannel ( const bool bNIsServer ) : | ||
| pTcpConnection ( nullptr ), | ||
| vecfGains ( MAX_NUM_CHANNELS, 1.0f ), | ||
| vecfPannings ( MAX_NUM_CHANNELS, 0.5f ), | ||
| iCurSockBufNumFrames ( INVALID_INDEX ), | ||
|
|
@@ -59,6 +60,7 @@ CChannel::CChannel ( const bool bNIsServer ) : | |
| bIsEnabled ( false ), | ||
| bIsServer ( bNIsServer ), | ||
| bIsIdentified ( false ), | ||
| iChannelToken ( 0 ), | ||
| iAudioFrameSizeSamples ( DOUBLE_SYSTEM_FRAME_SIZE_SAMPLES ), | ||
| SignalLevelMeter ( false, 0.5 ) // server mode with mono out and faster smoothing | ||
| { | ||
|
|
@@ -103,7 +105,7 @@ CChannel::CChannel ( const bool bNIsServer ) : | |
|
|
||
| QObject::connect ( &Protocol, &CProtocol::ChangeChanPan, this, &CChannel::OnChangeChanPan ); | ||
|
|
||
| QObject::connect ( &Protocol, &CProtocol::ClientIDReceived, this, &CChannel::ClientIDReceived ); | ||
| QObject::connect ( &Protocol, &CProtocol::ClientIDReceived, this, &CChannel::OnClientIDReceived ); | ||
|
|
||
| QObject::connect ( &Protocol, &CProtocol::RawAudioSupported, this, &CChannel::RawAudioSupported ); | ||
|
|
||
|
|
@@ -736,3 +738,36 @@ void CChannel::UpdateSocketBufferSize() | |
| SetSockBufNumFrames ( SockBuf.GetAutoSetting(), true ); | ||
| } | ||
| } | ||
|
|
||
| void CChannel::OnClientIDReceived ( int iChanID ) | ||
| { | ||
| qDebug() << Q_FUNC_INFO << "iChanID =" << iChanID; | ||
| emit ClientIDReceived ( iChanID ); | ||
| } | ||
|
|
||
| void CChannel::CreateConClientListMes ( const CVector<CChannelInfo>& vecChanInfo, CProtocol& ConnLessProtocol ) | ||
| { | ||
| if ( pTcpConnection ) | ||
| { | ||
| qDebug() << "- sending client list via TCP"; | ||
|
|
||
| ConnLessProtocol.CreateCLConnClientsListMes ( InetAddr, vecChanInfo, pTcpConnection ); | ||
|
Member
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. I think we should make clear why the connectionless protocol is used here - I suppose since TCP handles the session, it's enough. |
||
| } | ||
| else | ||
| { | ||
| qDebug() << "- sending client list via UDP"; | ||
|
|
||
| Protocol.CreateConClientListMes ( vecChanInfo ); | ||
| } | ||
| } | ||
|
|
||
| void CChannel::SetTcpConnection ( CTcpConnection* pConnection ) | ||
| { | ||
| if ( pTcpConnection ) | ||
| { | ||
| // this should never happen, but handle it if it does | ||
| pTcpConnection->disconnectFromHost(); | ||
| } | ||
|
|
||
| pTcpConnection = pConnection; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, makes sense. Next to try and work out how the fits around it 🙂 .