Lines Matching defs:peer

23 /*	void qmgr_peer_free(peer)
24 /* QMGR_PEER *peer;
31 /* Each peer corresponds to a specific job and destination.
35 /* qmgr_peer_create() creates an empty peer structure for the named
37 /* if a peer for given combination already exists.
39 /* qmgr_peer_find() looks up the peer for the named destination
40 /* for the named job. A null result means that the peer
43 /* qmgr_peer_obtain() looks up the peer for the named destination
46 /* qmgr_peer_free() disposes of a per-job peer after all
48 /* of a peer still in use.
50 /* qmgr_peer_select() attempts to find a peer of named job that
78 /* qmgr_peer_create - create and initialize message peer structure */
82 QMGR_PEER *peer;
84 peer = (QMGR_PEER *) mymalloc(sizeof(QMGR_PEER));
85 peer->queue = queue;
86 peer->job = job;
87 QMGR_LIST_APPEND(job->peer_list, peer, peers);
88 htable_enter(job->peer_byname, queue->name, (void *) peer);
89 peer->refcount = 0;
90 QMGR_LIST_INIT(peer->entry_list);
91 return (peer);
94 /* qmgr_peer_free - release peer structure */
96 void qmgr_peer_free(QMGR_PEER *peer)
99 QMGR_JOB *job = peer->job;
100 QMGR_QUEUE *queue = peer->queue;
103 * Sanity checks. It is an error to delete a referenced peer structure.
105 if (peer->refcount != 0)
106 msg_panic("%s: refcount: %d", myname, peer->refcount);
107 if (peer->entry_list.next != 0)
110 QMGR_LIST_UNLINK(job->peer_list, QMGR_PEER *, peer, peers);
112 myfree((void *) peer);
115 /* qmgr_peer_find - lookup peer associated with given job and queue */
122 /* qmgr_peer_obtain - find/create peer associated with given job and queue */
126 QMGR_PEER *peer;
128 if ((peer = qmgr_peer_find(job, queue)) == 0)
129 peer = qmgr_peer_create(job, queue);
130 return (peer);
133 /* qmgr_peer_select - select next peer suitable for delivery within given job */
137 QMGR_PEER *peer;
144 for (peer = job->peer_list.next; peer; peer = peer->peers.next) {
145 queue = peer->queue;
146 if (queue->window > queue->busy_refcount && peer->entry_list.next != 0) {
147 QMGR_LIST_ROTATE(job->peer_list, peer, peers);
152 return (peer);