MCPcopy Create free account
hub / github.com/assaultcube/AC / polldeferredprocessing

Function polldeferredprocessing

source/src/server.cpp:3082–3131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3080}
3081
3082void polldeferredprocessing()
3083{
3084 static void *deferredprocessingthread_ti = NULL;
3085 if(!deferredprocessingthread_ti) deferredprocessingthread_ti = sl_createthread(deferredprocessingthread, NULL);
3086
3087 if(servinfoauth_done)
3088 {
3089 servinfoauth *sa = (servinfoauth *)servinfoauth_dropbox;
3090 servinfoauth_done = false;
3091 switch(sa->type)
3092 {
3093 case SV_SERVINFO_RESPONSE:
3094 {
3095 if(clients[sa->cn]->clientsequence == sa->clientsequence) // make sure, it's still the same client using that cn
3096 {
3097 if(!sa->success) disconnect_client(sa->cn, DISC_AUTH);
3098 else
3099 { // continue connecting
3100 client *cl = clients[sa->cn];
3101 if(sa->wantauth)
3102 {
3103 memcpy(cl->pubkey.u, sa->clientpubkey, 32);
3104 memcpy(cl->servinforesponse, sa->clientmsg, sa->clientmsglen + 64);
3105 bin2hex(cl->pubkeyhex, cl->pubkey.u, 32);
3106 cl->vita = vitas.access(cl->pubkey);
3107 if(!cl->vita)
3108 {
3109 vita_s v;
3110 memset(&v, 0, sizeof(v));
3111 cl->vita = &vitas.access(cl->pubkey, v);
3112 cl->vita->vs[VS_FIRSTLOGIN] = servclock;
3113 }
3114 if(cl->country[0] != '-') cl->vita->addcc(cl->country);
3115 cl->vita->addip(cl->ip);
3116 cl->vita->vs[VS_LASTLOGIN] = servclock;
3117 cl->needsauth = true; // may have been voluntary, but it's done
3118 int datecodes = 0, *vs = cl->vita->vs;
3119 loopi(VS_NUMCOUNTERS) datecodes |= vs[i] == 1 || (servclock - vs[i]) < 0 ? (1 << i) : 0;
3120 sendf(sa->cn, 1, "riimiss", SV_SERVINFO_CONTD, 1, 64, sa->servermsg, datecodes, cl->vita->clan, cl->vita->publiccomment);
3121 }
3122 else sendf(sa->cn, 1, "rii", SV_SERVINFO_CONTD, 0);
3123 }
3124 }
3125 break;
3126 }
3127 }
3128 delete sa;
3129 }
3130 if(!servinfoauths.empty() && servinfoauth_deferred.getvalue() < 1) servinfoauth_deferred.post();
3131}
3132
3133// server side processing of updates: does very little and most state is tracked client only
3134// could be extended to move more gameplay to server (at expense of lag)

Callers 1

serversliceFunction · 0.85

Calls 11

sl_createthreadFunction · 0.85
disconnect_clientFunction · 0.85
bin2hexFunction · 0.85
sendfFunction · 0.85
accessMethod · 0.80
addccMethod · 0.80
addipMethod · 0.80
getvalueMethod · 0.80
postMethod · 0.80
loopiFunction · 0.70
emptyMethod · 0.45

Tested by

no test coverage detected