MCPcopy Create free account
hub / github.com/ZDoom/Raze / PreGet

Function PreGet

source/common/engine/i_net.cpp:361–394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

359}
360
361sockaddr_in *PreGet (void *buffer, int bufferlen, bool noabort)
362{
363 static sockaddr_in fromaddress;
364 socklen_t fromlen;
365 int c;
366
367 fromlen = sizeof(fromaddress);
368 c = recvfrom (mysocket, (char *)buffer, bufferlen, 0,
369 (sockaddr *)&fromaddress, &fromlen);
370
371 if (c == SOCKET_ERROR)
372 {
373 int err = WSAGetLastError();
374 if (err == WSAEWOULDBLOCK || (noabort && err == WSAECONNRESET))
375 return NULL; // no packet
376
377 if (doomcom.consoleplayer == 0)
378 {
379 int node = FindNode(&fromaddress);
380 I_NetMessage("Got unexpected disconnect.");
381 doomcom.numnodes--;
382 for (; node < doomcom.numnodes; ++node)
383 sendaddress[node] = sendaddress[node + 1];
384
385 // Let remaining guests know that somebody left.
386 SendConAck(doomcom.numnodes, doomcom.numplayers);
387 }
388 else
389 {
390 I_NetError("The host disbanded the game unexpectedly");
391 }
392 }
393 return &fromaddress;
394}
395
396void PreSend (const void *buffer, int bufferlen, const sockaddr_in *to)
397{

Callers 4

Host_CheckForConnectsFunction · 0.85
Host_SendAllHereFunction · 0.85
Guest_ContactHostFunction · 0.85
Guest_WaitForOthersFunction · 0.85

Calls 4

FindNodeFunction · 0.85
I_NetMessageFunction · 0.85
SendConAckFunction · 0.85
I_NetErrorFunction · 0.85

Tested by

no test coverage detected