| | 2365 | | mroute(mid, dtid, tag, tmout) |
| | 2366 | | int mid; |
| | 2367 | | int dtid; |
| | 2368 | | int tag; |
| | 2369 | | struct timeval *tmout; |
| | 2370 | | { |
| | 2371 | | static int alreadyhere = 0; |
| | 2372 | | |
| | 2373 | | struct ttpcb *pcbp; |
| | 2374 | | int s; |
| | 2375 | | int sbf; |
| | | | ... |
| | 2378 | | int l; |
| | 2379 | | #ifdef SOCKLENISUINT |
| | 2380 | | #if defined(IMA_AIX4SP2) || defined(IMA_AIX5SP2) |
| | 2381 | | unsigned int oslen; |
| | 2382 | | #else |
| | 2383 | | size_t oslen; |
| | 2384 | | #endif |
| | 2385 | | #else |
| | 2386 | | int oslen; |
| | 2387 | | #endif |
| | 2388 | | int cc = 0; |
| | 2389 | | int gotem = 0; |
| | 2390 | | static struct timeval ztv = { 0, 0 }; |
| | 2391 | | char *addr = 0; |
| | 2392 | | #ifndef NOUNIXDOM |
| | 2393 | | struct sockaddr_un uns; |
| | 2394 | | char spath[PVMTMPNAMLEN];
|
| | 2395 | | #endif |
| | 2396 | | |
| | 2397 | | if (up = midtobuf(mid)) { |
| | 2398 | | up->m_dst = dtid; |
| | 2399 | | up->m_tag = tag; |
| | 2400 | | } |
| | 2401 | | |
| | 2402 | | if (alreadyhere) { |
| | 2403 | | if (up) { |
| | 2404 | | up->m_ref++; |
| | 2405 | | txlist[txwp] = up; |
| | 2406 | | if (++txwp >= sizeof(txlist)/sizeof(txlist[0])) |
| | 2407 | | txwp = 0; |
| | 2408 | | if (txwp == txrp) |
| | 2409 | | abort(); |
| | 2410 | | } |
| | 2411 | | |
| | 2412 | | |
| | 2413 | | |
| | 2414 | | if (!tmout || tmout->tv_sec || tmout->tv_usec) |
| | 2415 | | return PvmNotImpl;
|
| | 2416 | | |
| | 2417 | | return 0; |
| | 2418 | | } |
| | 2419 | | |
| | 2420 | | alreadyhere = 1; |
| | 2421 | | |
| | 2422 | | |
| | 2423 | | |
| | 2424 | | |
| | 2425 | | |
| | 2426 | | |
| | 2427 | | |
| | 2428 | | |
| | 2429 | | |
| | 2430 | | |
| | 2431 | | |
| | 2432 | | |
| | 2433 | | |
| | 2434 | | if (up) { |
| | 2435 | | |
| | 2436 | | #if !defined(IMA_MPP) |
| | 2437 | | |
| | 2438 | | |
| | 2439 | | |
| | 2440 | | |
| | 2441 | | |
| | 2442 | | |
| | 2443 | | |
| | 2444 | | |
| | 2445 | | |
| | 2446 | | if (pvmrouteopt == PvmRouteDirect
|
| | 2447 | | && dtid |
| | 2448 | | && TIDISTASK(dtid)
|
| | 2449 | | && dtid != pvmmytid |
| | 2450 | | && !ttpcb_find(dtid)) |
| | 2451 | | { |
| | 2452 | | |
| | 2453 | | #if !defined(NOUNIXDOM) |
| | 2454 | | |
| | 2455 | | |
| | 2456 | | if ((pvmmytid & TIDHOST) == (dtid & TIDHOST)) {
|
| | 2457 | | if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) == -1) {
|
| | 2458 | | pvmlogperror("mroute() socket"); |
| | 2459 | | |
| | 2460 | | } else { |
| | 2461 | | BZERO((char*)&uns, sizeof(uns));
|
| | 2462 | | uns.sun_family = AF_UNIX;
|
| | 2463 | | spath[0] = 0; |
| | 2464 | | (void)PVMTMPNAMFUN(spath);
|
| | 2465 | | strcpy(uns.sun_path, spath); |
| | 2466 | | |
| | 2467 | | oslen = sizeof(uns); |
| | 2468 | | if (bind(s, (struct sockaddr*)&uns, oslen) == -1) { |
| | 2469 | | pvmlogperror("mroute() bind"); |
| | 2470 | | (void)close(s); |
| | 2471 | | s = -1; |
| | 2472 | | |
| | 2473 | | } else { |
| | 2474 | | pcbp = ttpcb_creat(dtid); |
| | 2475 | | pcbp->tt_fd = s; |
| | 2476 | | addr = pcbp->tt_spath = STRALLOC(spath);
|
| | 2477 | | pcbp->tt_state = TTCONWAIT;
|
| | 2478 | | } |
| | 2479 | | } |
| | 2480 | | |
| | 2481 | | } else { |
| | 2482 | | #endif |
| | 2483 | | |
| | 2484 | | |
| | 2485 | | if ((s = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
|
| | 2486 | | pvmlogperror("mroute() socket"); |
| | 2487 | | |
| | | | ... |
| | 2524 | | } |
| | 2525 | | } |
| | 2526 | | } |
| | 2527 | | #if !defined(NOUNIXDOM) |
| | 2528 | | } |
| | 2529 | | #endif |
| | 2530 | | |
| | 2531 | | |
| | 2532 | | |
| | 2533 | | |
| | 2534 | | if (s >= 0) { |
| | 2535 | | |
| | 2536 | | |
| | 2537 | | sbf = pvm_setsbuf(pvm_mkbuf(PvmDataFoo));
|
| | 2538 | | l = TDPROTOCOL;
|
| | 2539 | | pvm_pkint(&l, 1, 1); |
| | 2540 | | pvm_pkstr(addr); |
| | 2541 | | sbf = pvm_setsbuf(sbf); |
| | 2542 | | up2 = midtobuf(sbf); |
| | 2543 | | up2->m_dst = dtid; |
| | 2544 | | up2->m_tag = TC_CONREQ;
|
| | 2545 | | up2->m_ctx = SYSCTX_TC;
|
| | 2546 | | cc = mxfer(up2, &ztv); |
| | 2547 | | pvm_freebuf(sbf); |
| | 2548 | | |
| | 2549 | | |
| | 2550 | | if (cc >= 0) { |
| | 2551 | | gotem += cc; |
| | 2552 | | sbf = pvm_setsbuf(pvm_mkbuf(PvmDataFoo));
|
| | 2553 | | l = PvmTaskExit;
|
| | 2554 | | pvm_pkint(&l, 1, 1); |
| | 2555 | | l = SYSCTX_TC;
|
| | 2556 | | pvm_pkint(&l, 1, 1); |
| | 2557 | | l = TC_TASKEXIT;
|
| | 2558 | | pvm_pkint(&l, 1, 1); |
| | 2559 | | l = 1; |
| | 2560 | | pvm_pkint(&l, 1, 1); |
| | 2561 | | pvm_pkint(&dtid, 1, 1); |
| | 2562 | | sbf = pvm_setsbuf(sbf); |