MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / activate

Method activate

Engine/source/platform/platformNet.cpp:444–481  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

442}
443
444template<class T> T ReservedSocketList<T>::activate(NetSocket socketToActivate, int family, bool useUDP, bool clearOnFail)
445{
446 MutexHandle h;
447 h.lock(mMutex, true);
448
449 int typeID = useUDP ? SOCK_DGRAM : SOCK_STREAM;
450 int protocol = useUDP ? PlatformNetState::getDefaultGameProtocol() : 0;
451
452 if ((U32)socketToActivate.getHandle() >= (U32)mSocketList.size())
453 return -1;
454
455 EntryType &entry = mSocketList[socketToActivate.getHandle()];
456 if (!entry.used)
457 return -1;
458
459 T socketFd = entry.value;
460 if (socketFd == -1)
461 {
462 socketFd = ::socket(family, typeID, protocol);
463
464 if (socketFd == InvalidSocketHandle)
465 {
466 if (clearOnFail)
467 {
468 remove(socketToActivate, false);
469 }
470 return InvalidSocketHandle;
471 }
472 else
473 {
474 entry.used = true;
475 entry.value = socketFd;
476 return socketFd;
477 }
478 }
479
480 return socketFd;
481}
482
483template<class T> T ReservedSocketList<T>::resolve(NetSocket socketToResolve)
484{

Callers 5

openListenPortMethod · 0.45
openConnectToMethod · 0.45
processMethod · 0.45
connectMethod · 0.45
bindAddressMethod · 0.45

Calls 4

getDefaultGameProtocolFunction · 0.85
lockMethod · 0.45
getHandleMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected