Changeset 4328
- Timestamp:
- 01/28/91 10:57:00 (19 years ago)
- Files:
-
- 1 modified
-
trunk/athena/lib/zephyr/server/hostm.c (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/athena/lib/zephyr/server/hostm.c
r4078 r4328 16 16 #ifndef lint 17 17 #ifndef SABER 18 static char rcsid_hostm_c[] = "$Header: /afs/dev.mit.edu/source/repository/athena/lib/zephyr/server/hostm.c,v 1.3 3 1990-12-29 01:35:08raeburn Exp $";18 static char rcsid_hostm_c[] = "$Header: /afs/dev.mit.edu/source/repository/athena/lib/zephyr/server/hostm.c,v 1.34 1991-01-28 15:57:00 raeburn Exp $"; 19 19 #endif 20 20 #endif … … 78 78 ZHostList_t *host; /* ptr to host struct */ 79 79 int server_index; /* index of server in the table */ 80 #if 0 /* always allocated in arrays */ 81 #if !defined(__GNUG__) || defined(FIXED_GXX) 82 void *operator new (unsigned int sz) { return zalloc (sz); } 83 void operator delete (void *ptr) { zfree (ptr, sizeof (hostlist)); } 84 #endif 85 #endif 80 86 }; 81 87 82 typedef struct _losinghost {83 struct _losinghost *q_forw;84 struct _losinghost *q_back;88 struct losinghost { 89 losinghost *q_forw; 90 losinghost *q_back; 85 91 ZHostList_t *lh_host; 86 92 timer lh_timer; 87 93 ZClient_t *lh_client; 88 } losinghost; 89 90 #define NULLLH ((struct _losinghost *) 0) 94 #if !defined(__GNUG__) || defined(FIXED_GXX) 95 void *operator new (unsigned int sz) { return zalloc (sz); } 96 void operator delete (void *ptr) { zfree (ptr, sizeof (losinghost)); } 97 #endif 98 }; 99 91 100 #define NULLHLT ((struct hostlist *) 0) 92 101 … … 96 105 static long lose_timo = LOSE_TIMO; 97 106 98 static losinghost *losing_hosts = NULLLH; /* queue of pings for hosts we107 static losinghost *losing_hosts; /* queue of pings for hosts we 99 108 doubt are really there */ 100 109 … … 113 122 /*ARGSUSED*/ 114 123 Code_t 115 hostm_dispatch(ZNotice_t *notice, int auth, struct sockaddr_in *who, ZServerDesc_t *server) 124 hostm_dispatch(ZNotice_t *notice, int auth, struct sockaddr_in *who, 125 ZServerDesc_t *server) 116 126 { 117 127 ZServerDesc_t *owner; … … 239 249 timer_reset(lhp->lh_timer); 240 250 xremque(lhp); 241 xfree(lhp);251 delete lhp; 242 252 lhp = lhp2->q_forw; 243 253 } else … … 280 290 for (i = 0; i < nservers; i++){ 281 291 if (i == me_server_idx) continue; 282 if (otherservers[i]. zs_state== SERV_UP)292 if (otherservers[i].state() == SERV_UP) 283 293 break; 284 294 } … … 297 307 newserver = (int) (random() % (nservers - 1)) + 1; 298 308 while (newserver == limbo_server_idx() || 299 (otherservers[newserver]. zs_state!= SERV_UP &&300 otherservers[newserver]. zs_state!= SERV_TARDY) ||309 (otherservers[newserver].state() != SERV_UP && 310 otherservers[newserver].state() != SERV_TARDY) || 301 311 newserver == me_server_idx); 302 312 hostm_deathgram(&host->zh_addr, &otherservers[newserver]); … … 322 332 #endif 323 333 if (!losing_hosts) { 324 if (!(losing_hosts = (losinghost *) xmalloc(sizeof(losinghost)))) { 334 losing_hosts = new losinghost; 335 if (!losing_hosts) { 325 336 syslog(LOG_ERR, "no mem losing host"); 326 337 return; … … 337 348 return; 338 349 } 339 if (!(newhost = (losinghost *) xmalloc(sizeof(losinghost)))) { 350 newhost = new losinghost; 351 if (!newhost) { 340 352 syslog(LOG_ERR, "no mem losing host 2"); 341 353 return; … … 378 390 #endif 379 391 xremque(which); 380 xfree(which);392 delete which; 381 393 (void) sigsetmask(omask); 382 394 return; … … 414 426 server_forward(¬ice, 0, &who); /* unauthentic */ 415 427 416 xfree(which);428 delete which; 417 429 (void) sigsetmask(omask); 418 430 return; … … 452 464 server_kill_clt(lhp->lh_client); 453 465 xremque(lhp); 454 xfree(lhp);466 delete lhp; 455 467 /* now that the remque adjusted the linked list, 456 468 we go forward again */ … … 489 501 #endif 490 502 xremque(lhp); 491 xfree(lhp);503 delete lhp; 492 504 /* now that the remque adjusted the linked list, 493 505 we go forward again */ … … 546 558 547 559 /* allocate a header */ 548 if (!(hlist = (ZHostList_t *)xmalloc(sizeof(ZHostList_t)))) { 549 syslog(LOG_WARNING, "hm_attach malloc"); 560 hlist = new ZHostList_t; 561 if (!hlist) { 562 syslog(LOG_WARNING, "hm_attach alloc"); 550 563 (void) sigsetmask(omask); 551 564 return(ENOMEM); … … 553 566 /* set up */ 554 567 if (!(clist = (ZClientList_t *)xmalloc(sizeof(ZClientList_t)))) { 555 xfree(hlist);568 delete hlist; 556 569 (void) sigsetmask(omask); 557 570 return(ENOMEM); … … 601 614 remove_host(host); 602 615 603 xfree(host);616 delete host; 604 617 (void) sigsetmask(omask); 605 618 return; … … 903 916 zdbug((LOG_DEBUG,"last host")); 904 917 #endif 905 xfree (all_hosts);918 xfree (all_hosts); 906 919 all_hosts = NULLHLT; 907 920 (void) sigsetmask(omask); … … 929 942 i++; 930 943 } 931 xfree (oldlist);944 xfree (oldlist); 932 945 (void) sigsetmask(omask); 933 946 return;
