| | |
| | | #include "socket_io.h" |
| | | #include <poll.h> |
| | | |
| | | #define OPEN_MAX 1024 |
| | | |
| | | #define GET(p) (*(uint32_t *)(p)) |
| | | #define PUT(p, val) (*(uint32_t *)(p) = (val)) |
| | | |
| | | #define GET_INT32(p) (*(int32_t *)(p)) |
| | | #define PUT_INT32(p, val) (*(int32_t *)(p) = (val)) |
| | | |
| | | |
| | | class NetModServerSocket; |
| | | |
| | |
| | | }; |
| | | |
| | | class NetModSocket { |
| | | struct pool{ /* Represents a pool of connected descriptors */ //line:conc:echoservers:beginpool |
| | | |
| | | int nready; /* Number of ready descriptors from select */ |
| | | int maxi; /* Highwater index into client array */ |
| | | struct pollfd conns[OPEN_MAX]; |
| | | // std::map<std::string, int> connectionMap; |
| | | } ; |
| | | |
| | | |
| | | friend class NetModServerSocket; |
| | | private: |
| | |
| | | static void * encode_response_head(net_mod_response_head_t & response); |
| | | static net_mod_response_head_t decode_response_head(void *_headbs); |
| | | |
| | | void init_conn_pool( pool& mpool); |
| | | int connect(pool& mpool, net_node_t* node); |
| | | void close_connect(pool& mpool , int connfd); |
| | | static void _destructor_(void *_pool); |
| | | static void _createKey_(void); |
| | | |
| | | int read_response(int clientfd, net_mod_recv_msg_t *recv_msg); |
| | | int write_request(int clientfd, net_mod_request_head_t &request_head, void *send_buf, int send_size, void *topic_buf, int topic_size); |
| | | |