fix memory leave and hang when handle_error
This commit is contained in:
parent
e3946383f4
commit
26e3c21c87
4 changed files with 12 additions and 4 deletions
|
|
@ -285,6 +285,7 @@ static int handle_connection(struct epoll_event* p)
|
||||||
ep2->iomgr = iomgr;
|
ep2->iomgr = iomgr;
|
||||||
|
|
||||||
endpoint_set_owner(ep2, c);
|
endpoint_set_owner(ep2, c);
|
||||||
|
endpoint_set_peer(ep2, c->myhost);
|
||||||
endpoint_set_msg_handler(ep2, (msg_handler_t)handle_msg);
|
endpoint_set_msg_handler(ep2, (msg_handler_t)handle_msg);
|
||||||
endpoint_set_err_handler(ep2, (err_handler_t)handle_endpoint_error);
|
endpoint_set_err_handler(ep2, (err_handler_t)handle_endpoint_error);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -575,7 +575,7 @@ int cmd_workerlist(int argc, char* argv[])
|
||||||
workers[i]->attrs->maxtmp, workers[i]->attrs->ndisks);
|
workers[i]->attrs->maxtmp, workers[i]->attrs->ndisks);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(workers);
|
free_Worker_list(rc, workers);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,7 @@ static int handle_output(endpoint_t* ep)
|
||||||
|
|
||||||
static int handle_error(endpoint_t* ep)
|
static int handle_error(endpoint_t* ep)
|
||||||
{
|
{
|
||||||
iomgr_t* iomgr = (iomgr_t*)ep->owner;
|
iomgr_t* iomgr = (iomgr_t*)ep->iomgr;
|
||||||
|
|
||||||
if (iomgr != NULL) {
|
if (iomgr != NULL) {
|
||||||
iomgr_unmonitor(iomgr, ep);
|
iomgr_unmonitor(iomgr, ep);
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,11 @@
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "xce/types.h"
|
#include "xce/types.h"
|
||||||
|
|
||||||
|
#define REQUEST_FROM(req) \
|
||||||
|
((req)->from == NULL) \
|
||||||
|
? "Unknown" \
|
||||||
|
: (((req)->from->name == NULL) ? "Unknown" : (req->from->name))
|
||||||
|
|
||||||
int xce_encode(xce_request_t* req, io_packet_t* pkt)
|
int xce_encode(xce_request_t* req, io_packet_t* pkt)
|
||||||
{
|
{
|
||||||
struct capn c;
|
struct capn c;
|
||||||
|
|
@ -19,7 +24,8 @@ int xce_encode(xce_request_t* req, io_packet_t* pkt)
|
||||||
Request_ptr rp;
|
Request_ptr rp;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
TRACE("%s request op %d seq %ld", __func__, req->opcode, req->seq);
|
TRACE("%s request op %d seq %ld from %s", __func__, req->opcode, req->seq,
|
||||||
|
REQUEST_FROM(req));
|
||||||
|
|
||||||
capn_init_malloc(&c);
|
capn_init_malloc(&c);
|
||||||
cs = capn_root(&c).seg;
|
cs = capn_root(&c).seg;
|
||||||
|
|
@ -58,7 +64,8 @@ int xce_decode(io_packet_t* pkt, xce_request_t* req)
|
||||||
|
|
||||||
decode_Request(req, &rq);
|
decode_Request(req, &rq);
|
||||||
|
|
||||||
TRACE("%s request opcode %d seq %ld", __func__, req->opcode, req->seq);
|
TRACE("%s request op %d seq %ld from %s", __func__, req->opcode, req->seq,
|
||||||
|
REQUEST_FROM(req));
|
||||||
capn_free(&c);
|
capn_free(&c);
|
||||||
|
|
||||||
free_packet(pkt);
|
free_packet(pkt);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue