Changeset 3210 for trunk/module-newcamd.c
- Timestamp:
- 09/24/10 10:25:46 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/module-newcamd.c
r3194 r3210 1039 1039 } 1040 1040 1041 static void newcamd_server(void *idx)1041 static void * newcamd_server(void *cli) 1042 1042 { 1043 1043 int rc; 1044 int cidx=(int)idx;1045 client[cidx].thread=pthread_self();1044 struct s_client * client = (struct s_client *) cli; 1045 client->thread=pthread_self(); 1046 1046 uchar mbuf[1024]; 1047 1047 1048 client [cs_idx].req=(uchar *)malloc(CS_MAXPENDING*REQ_SIZE);1049 if (!client [cs_idx].req)1048 client->req=(uchar *)malloc(CS_MAXPENDING*REQ_SIZE); 1049 if (!client->req) 1050 1050 { 1051 1051 cs_log("Cannot allocate memory (errno=%d)", errno); … … 1053 1053 } 1054 1054 1055 memset(client [cs_idx].req, 0, CS_MAXPENDING*REQ_SIZE);1056 client [cs_idx].ncd_server = 1;1057 cs_log("client connected to %d port", cfg->ncd_ptab.ports[client [cs_idx].port_idx].s_port);1058 1059 if (cfg->ncd_ptab.ports[client [cs_idx].port_idx].ncd_key_is_set) {1055 memset(client->req, 0, CS_MAXPENDING*REQ_SIZE); 1056 client->ncd_server = 1; 1057 cs_log("client connected to %d port", cfg->ncd_ptab.ports[client->port_idx].s_port); 1058 1059 if (cfg->ncd_ptab.ports[client->port_idx].ncd_key_is_set) { 1060 1060 //port has a des key specified 1061 newcamd_auth_client(client [cs_idx].ip, cfg->ncd_ptab.ports[client[cs_idx].port_idx].ncd_key);1061 newcamd_auth_client(client->ip, cfg->ncd_ptab.ports[client->port_idx].ncd_key); 1062 1062 } else { 1063 1063 //default global des key 1064 newcamd_auth_client(client [cs_idx].ip, cfg->ncd_key);1064 newcamd_auth_client(client->ip, cfg->ncd_key); 1065 1065 } 1066 1066 … … 1078 1078 for (r=0; r<CS_MAXREADER; r++) { 1079 1079 int flt = 0; 1080 if (!(reader[r].grp & client [cs_idx].grp)) continue; //test - skip unaccesible readers1080 if (!(reader[r].grp & client->grp)) continue; //test - skip unaccesible readers 1081 1081 if (reader[r].ftab.filts) { 1082 1082 for (j=0; j<CS_MAXFILTERS; j++) { … … 1087 1087 cs_debug("newcamd: extended: report card"); 1088 1088 1089 network_message_send(client [cs_idx].udp_fd,1090 &client [cs_idx].ncd_msgid, buf, 3,1091 client [cs_idx].ncd_skey, COMMTYPE_SERVER, 0, cd);1089 network_message_send(client->udp_fd, 1090 &client->ncd_msgid, buf, 3, 1091 client->ncd_skey, COMMTYPE_SERVER, 0, cd); 1092 1092 1093 1093 flt = 1; … … 1109 1109 1110 1110 cs_debug("newcamd: extended: report card"); 1111 network_message_send(client [cs_idx].udp_fd,1112 &client [cs_idx].ncd_msgid, buf, 3,1113 client [cs_idx].ncd_skey, COMMTYPE_SERVER, 0, cd);1111 network_message_send(client->udp_fd, 1112 &client->ncd_msgid, buf, 3, 1113 client->ncd_skey, COMMTYPE_SERVER, 0, cd); 1114 1114 } 1115 1115 } … … 1148 1148 if(rc==-9) 1149 1149 { 1150 if (client [cs_idx].ncd_keepalive)1150 if (client->ncd_keepalive) 1151 1151 newcamd_reply_ka(); 1152 1152 else … … 1155 1155 } 1156 1156 1157 if(client [cs_idx].req)1157 if(client->req) 1158 1158 { 1159 free(client [cs_idx].req);1160 client [cs_idx].req=0;1159 free(client->req); 1160 client->req=0; 1161 1161 } 1162 1162 1163 1163 cs_disconnect_client(); 1164 return NULL; 1164 1165 } 1165 1166
Note:
See TracChangeset
for help on using the changeset viewer.