#include <stddef.h>
#include <xseg/xseg.h>
-/* main mpeer structs */
+#include <st.h>
+/* main speer structs */
struct peer_req {
struct peerd *peer;
struct xseg_request *req;
ssize_t retval;
xport portno;
void *priv;
+#ifdef ST_THREADS
+ st_cond_t cond;
+#endif
};
struct peerd {
void *priv;
};
+enum dispatch_reason {
+ dispatch_accept = 0,
+ dispatch_receive = 1,
+ dispatch_internal = 2
+};
+
void fail(struct peerd *peer, struct peer_req *pr);
void complete(struct peerd *peer, struct peer_req *pr);
void defer_request(struct peerd *peer, struct peer_req *pr);
/* dispatch function that cannot block
* defers blocking calls to helper threads
*/
-int dispatch(struct peerd *peer, struct peer_req *pr, struct xseg_request *xseg);
+int dispatch(struct peerd *peer, struct peer_req *pr, struct xseg_request *xseg,
+ enum dispatch_reason reason);
void usage();