summaryrefslogtreecommitdiff
path: root/test/call.c
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-07-23 17:07:25 +0200
committerAlfred E. Heggestad <aeh@db.org>2016-07-23 17:07:25 +0200
commit7b4de472d27e9fe5201a8e0b847e5b2281b71452 (patch)
treed4cc3a4afee18b315c81b918900353475426d64d /test/call.c
parent7cedfabc81c9de28c3925e2d26abd39513013697 (diff)
added config 'call_max_calls' to limit maximum number of calls per ua
Diffstat (limited to 'test/call.c')
-rw-r--r--test/call.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/call.c b/test/call.c
index 629b890..b1e6c33 100644
--- a/test/call.c
+++ b/test/call.c
@@ -198,6 +198,7 @@ static void event_handler(struct ua *ua, enum ua_event ev,
}
if (ag->failed && ag->peer->failed) {
+ info("test: re_cancel on call failed\n");
re_cancel();
return;
}
@@ -530,3 +531,43 @@ int test_call_multiple(void)
return err;
}
+
+
+int test_call_max(void)
+{
+ struct fixture fix, *f = &fix;
+ unsigned i;
+ int err = 0;
+
+ /* Set the max-calls limit */
+ conf_config()->call.max_calls = 1;
+
+ fixture_init(f);
+
+ f->behaviour = BEHAVIOUR_ANSWER;
+
+ /* Make 2 calls, one should work and one should fail */
+ for (i=0; i<2; i++) {
+ err = ua_connect(f->a.ua, 0, NULL, f->buri, NULL, VIDMODE_OFF);
+ TEST_ERR(err);
+ }
+
+ f->b.failed = true; /* tiny hack to stop the runloop */
+
+ err = re_main_timeout(5000);
+ TEST_ERR(err);
+ TEST_ERR(fix.err);
+
+ ASSERT_EQ(0, fix.a.n_incoming);
+ ASSERT_EQ(1, fix.a.n_established);
+ ASSERT_EQ(1, fix.a.n_closed);
+ ASSERT_EQ(486, fix.a.close_scode);
+
+ ASSERT_EQ(1, fix.b.n_incoming);
+ ASSERT_EQ(0, fix.b.n_closed);
+
+ out:
+ fixture_close(f);
+
+ return err;
+}