static void * radegast_server(struct s_client * client, uchar *mbuf, int32_t n) { if (n<3) return NULL; if (!client->init_done) { radegast_auth_client(cur_client()->ip); client->init_done=1; } switch(mbuf[0]) { case 1: radegast_process_ecm(mbuf+2, mbuf[1]); break; default: radegast_process_unknown(mbuf); } return NULL; }
static void * radegast_server(void *cli) { int32_t n; uchar mbuf[1024]; struct s_client * client = (struct s_client *) cli; client->thread=pthread_self(); pthread_setspecific(getclient, cli); radegast_auth_client(cur_client()->ip); while ((n=get_request(mbuf))>0) { switch(mbuf[0]) { case 1: radegast_process_ecm(mbuf+2, mbuf[1]); break; default: radegast_process_unknown(mbuf); } } cs_disconnect_client(client); return NULL; }