L L4D2node

NET_CloseAllSockets

0x001c3f80 · 323 bytes · unknown

_Z19NET_CloseAllSocketsv

Decompiled

undefined (0 params)

/* WARNING: Unknown calling convention -- yet parameter storage is locked */
/* NET_CloseAllSockets() */

uint NET_CloseAllSockets(void)

{
  uint uVar1;
  uint uVar2;
  int *piVar3;
  int iVar4;
  int iVar5;
  int iVar6;
  bool bVar7;
  
  iVar4 = 0;
  iVar5 = net_sockets;
  if (0 < DAT_003ac4f0) {
    do {
      iVar6 = iVar4 * 0x10;
      piVar3 = (int *)(iVar5 + iVar6);
      if (*piVar3 != 0) {
        if (piVar3[2] == 0) {
          iVar5 = piVar3[3];
        }
        else {
          NET_CloseSocket(piVar3[2],-1);
          piVar3 = (int *)(net_sockets + iVar6);
          iVar5 = piVar3[3];
        }
        if (iVar5 != 0) {
          NET_CloseSocket(iVar5,-1);
          piVar3 = (int *)(net_sockets + iVar6);
        }
        *piVar3 = 0;
        iVar5 = net_sockets;
        iVar6 = iVar6 + net_sockets;
        *(undefined1 *)(iVar6 + 4) = 0;
        *(undefined4 *)(iVar6 + 8) = 0;
        *(undefined4 *)(iVar6 + 0xc) = 0;
      }
      iVar4 = iVar4 + 1;
    } while (iVar4 < DAT_003ac4f0);
  }
  uVar2 = ThreadGetCurrentId();
  if (uVar2 != DAT_003ac474) {
    LOCK();
    bVar7 = DAT_003ac474 != 0;
    uVar1 = uVar2;
    if (bVar7) {
      uVar1 = DAT_003ac474;
    }
    DAT_003ac474 = uVar1;
    UNLOCK();
    if (bVar7) {
      CThreadFastMutex::Lock(0x3ac474,uVar2);
      goto LAB_001c4041;
    }
  }
  DAT_003ac478 = DAT_003ac478 + 1;
LAB_001c4041:
  iVar5 = 0;
  if (0 < DAT_003ac46c) {
    do {
      while (iVar4 = *(int *)(s_PendingSockets + iVar5 * 0x18), iVar4 != 0) {
                    /* try { // try from 001c4072 to 001c4076 has its CatchHandler @ 001c40cf */
        NET_CloseSocket(iVar4,-1);
        iVar5 = iVar5 + 1;
        if (DAT_003ac46c <= iVar5) goto LAB_001c4082;
      }
      iVar5 = iVar5 + 1;
    } while (iVar5 < DAT_003ac46c);
  }
LAB_001c4082:
  DAT_003ac46c = 0;
  DAT_003ac478 = DAT_003ac478 - 1;
  uVar2 = DAT_003ac478;
  if (DAT_003ac478 == 0) {
    LOCK();
    UNLOCK();
    uVar2 = DAT_003ac474;
    DAT_003ac474 = 0;
  }
  return uVar2;
}

SourceMod gamedata

paste into addons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)

Just a Signatures{} block, ready to drop into a gamedata file. Wire it up in your plugin however you like - SDKCall, DHooks, raw memory ops, or anything else.



        

        

          

Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.

Return-type handling cheatsheet (DHookReturn)