aboutsummaryrefslogtreecommitdiffstats
path: root/src/mtp_link.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-01-23 23:31:26 +0100
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-01-24 15:35:08 +0100
commitea5ce23d72cbb6571862a4356ca21890aae5ecc9 (patch)
treef21942c09ed14873540e8b96d3e551fa08e50d36 /src/mtp_link.c
parent8ade9b7bc235b644a1ce63ba0db9e855b118d267 (diff)
mtp: Make it possible to block a link.
The semantic of a block is to take the physical link down, call mtp_link_down and to make sure that the link remains down and no packets are forwarded there. The unblock call will reset the link and this should get it back into operation again.
Diffstat (limited to 'src/mtp_link.c')
-rw-r--r--src/mtp_link.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mtp_link.c b/src/mtp_link.c
index d885738..8a55aae 100644
--- a/src/mtp_link.c
+++ b/src/mtp_link.c
@@ -167,3 +167,17 @@ void mtp_link_failure(struct mtp_link *link)
rate_ctr_inc(&link->ctrg->ctr[MTP_LNK_ERROR]);
link->reset(link);
}
+
+void mtp_link_block(struct mtp_link *link)
+{
+ link->blocked = 1;
+ link->shutdown(link);
+}
+
+void mtp_link_unblock(struct mtp_link *link)
+{
+ if (!link->blocked)
+ return;
+ link->blocked = 0;
+ link->reset(link);
+}