Fixed release of relations between bridge and interface instances (ports)

This commit is contained in:
Andreas Eversberg 2012-02-21 18:03:43 +01:00
parent 65ce8fa13a
commit 4a7489749f
2 changed files with 12 additions and 7 deletions

View File

@ -114,6 +114,7 @@ fail:
message->param.disconnectinfo.cause = cause;
message->param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL;
message_put(message);
ea_endpoint->free_portlist(portlist);
/* destroy endpoint */
ea_endpoint->ep_use = 0;
@ -223,18 +224,22 @@ fail:
/* port MESSAGE_RELEASE */
void EndpointAppBridge::port_release(struct port_list *portlist, int message_type, union parameter *param)
{
unsigned int remote;
struct port_list *remote;
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) epoint received release from port\n");
if (!ea_endpoint->ep_portlist || !ea_endpoint->ep_portlist->next)
goto out;
if (ea_endpoint->ep_portlist->port_id == portlist->port_id)
remote = ea_endpoint->ep_portlist->next->port_id;
remote = ea_endpoint->ep_portlist->next;
else
remote = ea_endpoint->ep_portlist->port_id;
remote = ea_endpoint->ep_portlist;
/* forward release */
message_forward(ea_endpoint->ep_serial, remote, EPOINT_TO_PORT, param);
message_forward(ea_endpoint->ep_serial, remote->port_id, EPOINT_TO_PORT, param);
/* remove relations to in and out port */
ea_endpoint->free_portlist(portlist);
ea_endpoint->free_portlist(remote);
out:
/* destroy endpoint */

View File

@ -109,7 +109,7 @@ Endpoint::~Endpoint(void)
portlist = ep_portlist;
while(portlist) {
if (portlist->port_id) {
PERROR("warning: still relation to port (portlist list)\n");
PERROR("Endpoint(%d) warning: still relation to port %d (portlist list)\n", ep_serial, portlist->port_id);
}
mtemp = portlist;
portlist = portlist->next;
@ -147,7 +147,7 @@ struct port_list *Endpoint::portlist_new(unsigned int port_id, int port_type, in
/* portlist structure */
portlist = (struct port_list *)MALLOC(sizeof(struct port_list));
ememuse++;
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) allocating port_list.\n", ep_serial);
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) allocating port_list, attaching to port %d\n", ep_serial, port_id);
/* add port_list to chain */
portlist->next = NULL;
@ -186,7 +186,7 @@ void Endpoint::free_portlist(struct port_list *portlist)
*tempp=portlist->next;
/* free */
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) removed port_list from endpoint\n", ep_serial);
PDEBUG(DEBUG_EPOINT, "EPOINT(%d) removed port %d from port_list of endpoint\n", ep_serial, portlist->port_id);
FREE(portlist, sizeof(struct port_list));
ememuse--;
}