Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 90729
b: refs/heads/master
c: 0c3141e
h: refs/heads/master
i:
  90727: a457a38
v: v3
  • Loading branch information
Allan Stephens authored and David S. Miller committed Apr 15, 2008
1 parent d7d2c87 commit 1d90694
Show file tree
Hide file tree
Showing 4 changed files with 609 additions and 432 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b89741a0cc162511b4341c07e17e1bd4c8b4621d
refs/heads/master: 0c3141e910eaaa0b617e2f26c69b266d1cd1f035
6 changes: 6 additions & 0 deletions trunk/include/net/tipc/tipc_port.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,12 @@ struct tipc_port *tipc_get_port(const u32 ref);

void *tipc_get_handle(const u32 ref);

/*
* The following routines require that the port be locked on entry
*/

int tipc_disconnect_port(struct tipc_port *tp_ptr);


#endif

Expand Down
31 changes: 24 additions & 7 deletions trunk/net/tipc/port.c
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,28 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer)
return res;
}

/**
* tipc_disconnect_port - disconnect port from peer
*
* Port must be locked.
*/

int tipc_disconnect_port(struct tipc_port *tp_ptr)
{
int res;

if (tp_ptr->connected) {
tp_ptr->connected = 0;
/* let timer expire on it's own to avoid deadlock! */
tipc_nodesub_unsubscribe(
&((struct port *)tp_ptr)->subscription);
res = TIPC_OK;
} else {
res = -ENOTCONN;
}
return res;
}

/*
* tipc_disconnect(): Disconnect port form peer.
* This is a node local operation.
Expand All @@ -1248,17 +1270,12 @@ int tipc_connect2port(u32 ref, struct tipc_portid const *peer)
int tipc_disconnect(u32 ref)
{
struct port *p_ptr;
int res = -ENOTCONN;
int res;

p_ptr = tipc_port_lock(ref);
if (!p_ptr)
return -EINVAL;
if (p_ptr->publ.connected) {
p_ptr->publ.connected = 0;
/* let timer expire on it's own to avoid deadlock! */
tipc_nodesub_unsubscribe(&p_ptr->subscription);
res = TIPC_OK;
}
res = tipc_disconnect_port((struct tipc_port *)p_ptr);
tipc_port_unlock(p_ptr);
return res;
}
Expand Down
Loading

0 comments on commit 1d90694

Please sign in to comment.