//manages per rpc info
struct caller {
- caller(unsigned int xxid, unmarshall *un);
+ caller(int xxid, unmarshall *un);
~caller();
- unsigned int xid;
+ int xid;
unmarshall *un;
int intret;
bool done;
};
void get_refconn(connection **ch);
- void update_xid_rep(unsigned int xid);
+ void update_xid_rep(int xid);
sockaddr_in dst_;
unsigned int clt_nonce_;
unsigned int srv_nonce_;
bool bind_done_;
- unsigned int xid_;
+ int xid_;
int lossytest_;
bool retrans_;
bool reachable_;
std::condition_variable destroy_wait_c_;
std::map<int, caller *> calls_;
- std::list<unsigned int> xid_rep_window_;
+ std::list<int> xid_rep_window_;
struct request {
request() { clear(); }
// has been sent; in that case buf points to a copy of the reply,
// and sz holds the size of the reply.
struct reply_t {
- reply_t (unsigned int _xid) {
+ reply_t (int _xid) {
xid = _xid;
cb_present = false;
buf = NULL;
sz = 0;
}
- reply_t (unsigned int _xid, char *_buf, int _sz) {
+ reply_t (int _xid, char *_buf, size_t _sz) {
xid = _xid;
cb_present = true;
buf = _buf;
sz = _sz;
}
- unsigned int xid;
+ int xid;
bool cb_present; // whether the reply buffer is valid
char *buf; // the reply buffer
- int sz; // the size of reply buffer
+ size_t sz; // the size of reply buffer
};
- int port_;
+ unsigned int port_;
unsigned int nonce_;
// provide at most once semantics by maintaining a window of replies
std::map<unsigned int, std::list<reply_t> > reply_window_;
void free_reply_window(void);
- void add_reply(unsigned int clt_nonce, unsigned int xid, char *b, int sz);
+ void add_reply(unsigned int clt_nonce, int xid, char *b, size_t sz);
rpcstate_t checkduplicate_and_update(unsigned int clt_nonce,
- unsigned int xid, unsigned int rep_xid,
- char **b, int *sz);
+ int xid, int rep_xid,
+ char **b, size_t *sz);
void updatestat(unsigned int proc);
std::map<unsigned int, connection *> conns_;
// counting
- const int counting_;
- int curr_counts_;
- std::map<int, int> counts_;
+ const size_t counting_;
+ size_t curr_counts_;
+ std::map<unsigned int, size_t> counts_;
int lossytest_;
bool reachable_;
// map proc # to function
- std::map<int, handler *> procs_;
+ std::map<unsigned int, handler *> procs_;
std::mutex procs_m_; // protect insert/delete to procs[]
std::mutex count_m_; //protect modification of counts
protected:
struct djob_t {
- djob_t (connection *c, char *b, int bsz):buf(b),sz(bsz),conn(c) {}
+ djob_t (connection *c, char *b, size_t bsz):buf(b),sz(bsz),conn(c) {}
char *buf;
- int sz;
+ size_t sz;
connection *conn;
};
void dispatch(djob_t *);
tcpsconn* listener_;
public:
- rpcs(unsigned int port, int counts=0);
+ rpcs(unsigned int port, size_t counts=0);
~rpcs();
- inline int port() { return listener_->port(); }
+ inline unsigned int port() { return listener_->port(); }
//RPC handler for clients binding
- int rpcbind(int &r, int a);
+ int rpcbind(unsigned int &r, int a);
void set_reachable(bool r) { reachable_ = r; }
reg1(proc, marshalled_func<F, ReturnOnFailure>::wrap(f, c));
}
-void make_sockaddr(const char *hostandport, struct sockaddr_in *dst);
-void make_sockaddr(const char *host, const char *port,
- struct sockaddr_in *dst);
+void make_sockaddr(const std::string &hostandport, struct sockaddr_in *dst);
+void make_sockaddr(const std::string &host, const std::string &port, struct
+ sockaddr_in *dst);
#endif