MCPcopy Create free account
hub / github.com/baldurk/renderdoc / HandleHandshakeClient

Function HandleHandshakeClient

renderdoc/core/remote_server.cpp:188–281  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

186};
187
188static bool HandleHandshakeClient(ActiveClient &activeClient, ClientThread *threadData)
189{
190 uint32_t ip = threadData->socket->GetRemoteIP();
191
192 uint32_t version = 0;
193
194 bool activeConnectionDesired = false;
195 bool activeConnectionEstablished = false;
196
197 {
198 ReadSerialiser ser(new StreamReader(threadData->socket, Ownership::Nothing), Ownership::Stream);
199
200 ser.SetStreamingMode(true);
201
202 // this thread just handles receiving the handshake and sending a busy signal without blocking
203 // the server thread
204 RemoteServerPacket type = ser.ReadChunk<RemoteServerPacket>();
205
206 if(ser.IsErrored() || type != RemoteServerPacket::Handshake)
207 {
208 RDCWARN("Didn't receive proper handshake");
209 return activeConnectionEstablished;
210 }
211
212 SERIALISE_ELEMENT(version);
213 SERIALISE_ELEMENT(activeConnectionDesired);
214
215 ser.EndChunk();
216 }
217
218 {
219 WriteSerialiser ser(new StreamWriter(threadData->socket, Ownership::Nothing), Ownership::Stream);
220
221 ser.SetStreamingMode(true);
222
223 if(version != RemoteServerProtocolVersion)
224 {
225 RDCLOG("Connection using protocol %u, but we are running %u", version,
226 RemoteServerProtocolVersion);
227
228 // as of 1.23 we started serialising our version so the other end knows what it's talking
229 // to.
230 if(version >= MAKE_REMOTE_SERVER_VERSION(1, 23))
231 {
232 SCOPED_SERIALISE_CHUNK(RemoteServerPacket::VersionMismatch2);
233
234 SERIALISE_ELEMENT(RemoteServerProtocolVersion);
235 }
236 else
237 {
238 SCOPED_SERIALISE_CHUNK(RemoteServerPacket::VersionMismatch);
239 }
240 }
241 else
242 {
243 bool busy = false;
244
245 {

Callers 1

BecomeRemoteServerMethod · 0.85

Calls 5

GetIPOctetFunction · 0.85
SetStreamingModeMethod · 0.80
EndChunkMethod · 0.80
GetRemoteIPMethod · 0.45
IsErroredMethod · 0.45

Tested by

no test coverage detected