L L4D2node

CSocketCreator::ProcessAccept

0x0028c5b0 · 392 bytes · __thiscall

_ZN14CSocketCreator13ProcessAcceptEv

Decompiled

undefined (1 param)

/* CSocketCreator::ProcessAccept() */

void __thiscall CSocketCreator::ProcessAccept(CSocketCreator *this)

{
  undefined4 *puVar1;
  int *piVar2;
  char cVar3;
  int iVar4;
  int iVar5;
  int *piVar6;
  char *pcVar7;
  int in_GS_OFFSET;
  socklen_t local_44;
  int local_40;
  int local_3c;
  int local_38;
  undefined2 local_34;
  sockaddr local_30;
  int local_20;
  
  local_44 = 0x10;
  local_20 = *(int *)(in_GS_OFFSET + 0x14);
  iVar4 = accept(*(int *)(this + 0x18),&local_30,&local_44);
  if (iVar4 == -1) {
    piVar6 = __errno_location();
    iVar4 = *piVar6;
    if (((iVar4 != 0xb) && (iVar4 != 0x73)) && (iVar4 != 4)) {
      pcVar7 = strerror(iVar4);
      Warning("Socket ProcessAccept Error: %s\n",pcVar7);
    }
    goto LAB_0028c60a;
  }
  cVar3 = ConfigureSocket(this,iVar4);
  if (cVar3 == '\0') {
LAB_0028c602:
    close(iVar4);
  }
  else {
    netadr_s::SetIP((netadr_s *)&local_3c,0);
    netadr_s::SetPort((netadr_s *)&local_3c,0);
    netadr_s::SetType((netadr_s *)&local_3c,3);
    netadr_s::SetFromSockadr((netadr_s *)&local_3c,&local_30);
    puVar1 = *(undefined4 **)this;
    if (puVar1 != (undefined4 *)0x0) {
      cVar3 = (**(code **)*puVar1)(puVar1,iVar4,&local_3c);
      if (cVar3 == '\0') goto LAB_0028c602;
    }
    iVar5 = CUtlVector<CSocketCreator::AcceptedSocket_t,CUtlMemory<CSocketCreator::AcceptedSocket_t,int>>
            ::InsertBefore((CUtlVector<CSocketCreator::AcceptedSocket_t,CUtlMemory<CSocketCreator::AcceptedSocket_t,int>>
                            *)(this + 4),*(int *)(this + 0x10));
    piVar6 = (int *)(*(int *)(this + 4) + iVar5 * 0x14);
    *piVar6 = iVar4;
    local_40 = 0;
    piVar6[1] = local_3c;
    piVar6[2] = local_38;
    piVar6[4] = 0;
    *(undefined2 *)(piVar6 + 3) = local_34;
    piVar2 = *(int **)this;
    if (piVar2 != (int *)0x0) {
      (**(code **)(*piVar2 + 4))(piVar2,iVar4,&local_3c,&local_40);
    }
    piVar6[4] = local_40;
  }
LAB_0028c60a:
  if (local_20 == *(int *)(in_GS_OFFSET + 0x14)) {
    return;
  }
                    /* WARNING: Subroutine does not return */
  __stack_chk_fail();
}

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)