@@ -117,7 +117,20 @@ void AppleMIDISession<UdpClass, Settings, Platform>::ReceivedInvitation(AppleMID
117
117
template <class UdpClass , class Settings , class Platform >
118
118
void AppleMIDISession<UdpClass, Settings, Platform>::ReceivedControlInvitation(AppleMIDI_Invitation_t &invitation)
119
119
{
120
+ #ifndef ONE_PARTICIPANT
121
+ Participant<Settings> participant;
122
+ #endif
123
+ participant.kind = Listener;
124
+ participant.ssrc = invitation.ssrc ;
125
+ participant.remoteIP = controlPort.remoteIP ();
126
+ participant.remotePort = controlPort.remotePort ();
127
+ participant.lastSyncExchangeTime = now;
120
128
#ifdef KEEP_SESSION_NAME
129
+ strncpy (participant.sessionName , invitation.sessionName , DefaultSettings::MaxSessionNameLen);
130
+ #endif
131
+
132
+ #ifdef KEEP_SESSION_NAME
133
+ // Re-use the invitation for acceptance. Overwrite sessionName with ours
121
134
strncpy (invitation.sessionName , localName, DefaultSettings::MaxSessionNameLen);
122
135
invitation.sessionName [DefaultSettings::MaxSessionNameLen] = ' \0 ' ;
123
136
#endif
@@ -166,19 +179,7 @@ void AppleMIDISession<UdpClass, Settings, Platform>::ReceivedControlInvitation(A
166
179
#endif
167
180
return ;
168
181
}
169
-
170
- #ifndef ONE_PARTICIPANT
171
- Participant<Settings> participant;
172
- #endif
173
- participant.kind = Listener;
174
- participant.ssrc = invitation.ssrc ;
175
- participant.remoteIP = controlPort.remoteIP ();
176
- participant.remotePort = controlPort.remotePort ();
177
- participant.lastSyncExchangeTime = now;
178
- #ifdef KEEP_SESSION_NAME
179
- strncpy (participant.sessionName , invitation.sessionName , DefaultSettings::MaxSessionNameLen);
180
- #endif
181
-
182
+
182
183
#ifndef ONE_PARTICIPANT
183
184
participants.push_back (participant);
184
185
#endif
@@ -205,6 +206,12 @@ void AppleMIDISession<UdpClass, Settings, Platform>::ReceivedDataInvitation(Appl
205
206
return ;
206
207
}
207
208
209
+ #ifdef KEEP_SESSION_NAME
210
+ // Re-use the invitation for acceptance. Overwrite sessionName with ours
211
+ strncpy (invitation.sessionName , localName, DefaultSettings::MaxSessionNameLen);
212
+ invitation.sessionName [DefaultSettings::MaxSessionNameLen] = ' \0 ' ;
213
+ #endif
214
+
208
215
// writeInvitation will alter the values of the invitation,
209
216
// in order to safe memory and computing cycles its easier to make a copy
210
217
// of the ssrc here.
@@ -217,7 +224,7 @@ void AppleMIDISession<UdpClass, Settings, Platform>::ReceivedDataInvitation(Appl
217
224
// Inform that we have an established connection
218
225
if (nullptr != _connectedCallback)
219
226
#ifdef KEEP_SESSION_NAME
220
- _connectedCallback (ssrc_, invitation. sessionName );
227
+ _connectedCallback (ssrc_, pParticipant-> sessionName );
221
228
#else
222
229
_connectedCallback (ssrc_, nullptr );
223
230
#endif
0 commit comments