16 : maxCli(maxClients), maxSess(maxSessions) {
22 nameMap =
new map<string, int>();
33 pthread_mutex_destroy(&
mapLock);
38 if (pthread_mutex_init(&
mapLock,NULL) != 0)
return false;
39 for (
int clx = 1; clx <=
maxCli; clx++) {
41 if (pthread_cond_init(&
cvec[clx].busyCond,NULL) != 0)
95 map<string, int>::iterator p =
nameMap->find(cname);
98 while (
cvec[clx].busyBit) {
102 pthread_cond_signal(&
cvec[clx].busyCond);
118 pthread_cond_signal(&
cvec[clx].busyCond);
132 if (sess == 0) {
unlockMap();
return 0; }
134 while (
cvec[clx].busyBit) {
138 pthread_cond_signal(&
cvec[clx].busyCond);
156 while (
cvec[clx].busyBit) {
160 pthread_cond_signal(&
cvec[clx].busyCond);
178 int nuClx =
clients->nextIn(clx);
181 pthread_cond_signal(&
cvec[clx].busyCond);
185 while (
cvec[nuClx].busyBit) {
190 pthread_cond_signal(&
cvec[clx].busyCond);
191 pthread_cond_signal(&
cvec[nuClx].busyCond);
198 pthread_cond_signal(&
cvec[clx].busyCond);
218 privileges priv,
int clx) {
220 map<string,int>::iterator p =
nameMap->find(cname);
223 if (
clients->isIn(clx)) clx = 0;
228 nameMap->insert(pair<string,int>(cname,clx));
250 while (
cvec[clx].firstSess != 0)
254 pthread_cond_signal(&
cvec[clx].busyCond);
270 if (sess == 0) {
unlockMap();
return 0; }
274 if (
cvec[clx].firstSess == 0) {
293 if (
cvec[clx].firstSess == sess) {
417 bool ClientTable::writeRecord(
int clx) {
419 if (clx < 0 || clx > maxClients)
return false;
424 s.copy(firstRecord + clx*
RECORD_SIZE, RECORD_SIZE);
441 case LIMITED: s +=
"limited";
break;
442 case STANDARD: s +=
"standard";
break;
443 case ADMIN: s +=
"admin";
break;
444 case ROOT: s +=
"root";
break;