| | 3707 | | sendmessage(mp) |
| | 3708 | | struct pmsg *mp; |
| | 3709 | | { |
| | 3710 | | struct hostd *hp = 0; |
| | 3711 | | struct task *tp; |
| | 3712 | | struct frag *fp; |
| | 3713 | | struct pkt *pp; |
| | 3714 | | int ff = FFSOM;
|
| | 3715 | | int dst = mp->m_dst; |
| | 3716 | | |
| | 3717 | | if (!dst) { |
| | 3718 | | pvmlogerror("sendmessage() what? to t0\n"); |
| | 3719 | | } |
| | 3720 | | |
| | 3721 | | if (pvmdebmask & PDMMESSAGE) {
|
| | 3722 | | pvmlogprintf("sendmessage() dst t%x ctx %d tag %s len %d\n", |
| | 3723 | | dst, mp->m_ctx, pvmnametag(mp->m_tag, (int *)0), mp->m_len); |
| | 3724 | | } |
| | 3725 | | |
| | 3726 | | |
| | 3727 | | |
| | 3728 | | |
| | 3729 | | |
| | 3730 | | if ((fp = mp->m_frag->fr_link) == mp->m_frag) { |
| | 3731 | | fp = fr_new(MAXHDR);
|
| | 3732 | | fp->fr_dat += MAXHDR;
|
| | 3733 | | LISTPUTBEFORE(mp->m_frag, fp, fr_link, fr_rlink);
|
| | 3734 | | } |
| | 3735 | | |
| | 3736 | | |
| | 3737 | | |
| | 3738 | | |
| | 3739 | | |
| | 3740 | | if (!(dst & tidhmask) || (dst & tidhmask) == myhostpart) { |
| | 3741 | | |
| | 3742 | | if (TIDISTASK(dst)) {
|
| | 3743 | | |
| | 3744 | | if (tp = task_find(dst)) { |
| | 3745 | | mesg_to_task(tp, mp); |
| | 3746 | | |
| | 3747 | | } else |
| | 3748 | | if (pvmdebmask & (PDMMESSAGE|PDMAPPL)) {
|
| | 3749 | | pvmlogprintf( |
| | 3750 | | "sendmessage() scrapped, no such task t%x\n", |
| | 3751 | | dst); |
| | 3752 | | } |
| | 3753 | | |
| | 3754 | | } else { |
| | 3755 | | mp->m_ref++; |
| | 3756 | | mesg_rewind(mp); |
| | 3757 | | netentry(hosts->ht_hosts[hosts->ht_local], mp); |
| | 3758 | | } |
| | 3759 | | |
| | 3760 | | } else { |
| | 3761 | | |
| | 3762 | | |
| | 3763 | | |
| | 3764 | | if (runstate == PVMDHTUPD)
|
| | 3765 | | hp = tidtohost(newhosts, dst); |
| | 3766 | | if (!hp && !(hp = tidtohost(hosts, dst))) { |
| | 3767 | | if (pvmdebmask & (PDMMESSAGE|PDMAPPL)) {
|
| | 3768 | | pvmlogprintf("sendmessage() scrapped, no such host t%x\n", |
| | 3769 | | dst); |
| | 3770 | | } |
| | 3771 | | goto bail; |
| | 3772 | | } |
| | 3773 | | |
| | 3774 | | |
| | 3775 | | |
| | 3776 | | do { |