summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorNélio Laranjeiro2011-04-15 16:46:45 +0200
committerNélio Laranjeiro2011-04-20 18:05:53 +0200
commit75222b5d11f8e99859b976834ea4ac223a5393c8 (patch)
treecd9b04abb07d89c064d48a067778a13e09287f16 /cesar/cp
parent1b04860048fd7cb6a56bdb969558a9509785d255 (diff)
cesar/cp/sta/mgr: change last_seen_ms to expired_date_ms, refs #2196
This renames last_seen_ms of cp_sta_t to expired_date_ms. This date is the date of last Beacon/MME reception from the station + Discovered_List_Expire_Time.
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/defs.h3
-rw-r--r--cesar/cp/sta/mgr/doc/sta_mgr.xmi2
-rw-r--r--cesar/cp/sta/mgr/src/net.c8
-rw-r--r--cesar/cp/sta/mgr/src/sta_mgr.c3
-rw-r--r--cesar/cp/sta/mgr/sta.h6
-rw-r--r--cesar/cp/sta/mgr/test/src/sta_mgr.c19
6 files changed, 16 insertions, 25 deletions
diff --git a/cesar/cp/defs.h b/cesar/cp/defs.h
index 8e94fc878e..f6ee325939 100644
--- a/cesar/cp/defs.h
+++ b/cesar/cp/defs.h
@@ -83,9 +83,6 @@
/** Hash key size. */
#define CP_HASH_KEY_SIZE 384
-/** Expiration delay for the station in seconds. */
-#define CP_STA_EXPIRATION_DELAY_S 60
-
/** Expiration delay for the networks. */
#define CP_NET_EXPIRATION_DELAY_S 70
diff --git a/cesar/cp/sta/mgr/doc/sta_mgr.xmi b/cesar/cp/sta/mgr/doc/sta_mgr.xmi
index 000727a5bc..6454d31635 100644
--- a/cesar/cp/sta/mgr/doc/sta_mgr.xmi
+++ b/cesar/cp/sta/mgr/doc/sta_mgr.xmi
@@ -460,7 +460,7 @@ If no station found, NULL value returned." isSpecification="false" isLeaf="false
<UML:Attribute comment="Indicate the state of the station." isSpecification="false" visibility="private" xmi.id="njbBHkqZRmmB" type="pBzpcllJMdsq" name="station_state" />
<UML:Attribute comment="The network whithin the station is associatied." isSpecification="false" visibility="private" xmi.id="30115" type="TRzc3eNXqLr1" name="net" />
<UML:Attribute comment="Indicate if the station is Backup CCo." isSpecification="false" visibility="public" xmi.id="15VSrGbyiZbv" type="BsXuVmQldfSS" name="is_backup_cco" />
- <UML:Attribute comment="Last date seen in the AVLN." isSpecification="false" visibility="public" xmi.id="7SdojrmkwHBl" type="oZHHg64PKBaq" name="last_seen_ms" />
+ <UML:Attribute comment="Date at the one the station is evicted from the AVLN." isSpecification="false" visibility="public" xmi.id="7SdojrmkwHBl" type="oZHHg64PKBaq" name="expired_date_ms" />
<UML:Attribute comment="The Reassembly context for the cl_interf." isSpecification="false" visibility="public" xmi.id="61vH7gnD8O1s" type="RTeIWtKTDaZV" name="reassembly_ctx" />
<UML:Attribute comment="The tei expiration date." isSpecification="false" visibility="public" xmi.id="O3jgPKW1znfn" type="oZHHg64PKBaq" name="tei_lease_ms" />
<UML:Attribute comment="The station CCo capability." isSpecification="false" visibility="public" xmi.id="uZ2PRCIQqOal" type="nnvOyvzkSE17" name="cco_cap" />
diff --git a/cesar/cp/sta/mgr/src/net.c b/cesar/cp/sta/mgr/src/net.c
index 1c0bd279e0..a2480423de 100644
--- a/cesar/cp/sta/mgr/src/net.c
+++ b/cesar/cp/sta/mgr/src/net.c
@@ -108,14 +108,8 @@ cp_net_garbage_station_list (cp_t *ctx, cp_net_t *net, u32 date_ms,
{
slab_addref (sta);
sta_next = cp_net_sta_get_next (ctx, net, sta);
-
- if (less_mod2p32(sta->last_seen_ms
- + MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S),
- date_ms))
- {
+ if (less_mod2p32(sta->expired_date_ms, date_ms))
cp_sta_mgr_sta_remove (ctx, sta);
- }
-
slab_release (sta);
}
}
diff --git a/cesar/cp/sta/mgr/src/sta_mgr.c b/cesar/cp/sta/mgr/src/sta_mgr.c
index 5b5142599f..241eaea5a2 100644
--- a/cesar/cp/sta/mgr/src/sta_mgr.c
+++ b/cesar/cp/sta/mgr/src/sta_mgr.c
@@ -719,7 +719,8 @@ cp_sta_mgr_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
}
}
/* Update the last seen value. */
- sta->last_seen_ms = cp_sta_core_get_date_ms (ctx);
+ sta->expired_date_ms = cp_sta_core_get_date_ms (ctx)
+ + HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS;
return sta;
}
diff --git a/cesar/cp/sta/mgr/sta.h b/cesar/cp/sta/mgr/sta.h
index ffdc8fc5b9..648db088ea 100644
--- a/cesar/cp/sta/mgr/sta.h
+++ b/cesar/cp/sta/mgr/sta.h
@@ -68,9 +68,11 @@ struct cp_sta_t
bool is_backup_cco;
/**
- * Last date seen in the AVLN.
+ * The date in ms at the one the station is considered removed from the
+ * AVLN. This is adjusted each time a beacon or a MME is received from
+ * this STA.
*/
- uint last_seen_ms;
+ u32 expired_date_ms;
/**
* The Reassembly context for the cl_interf.
diff --git a/cesar/cp/sta/mgr/test/src/sta_mgr.c b/cesar/cp/sta/mgr/test/src/sta_mgr.c
index f9ed17c66b..458f5c46c4 100644
--- a/cesar/cp/sta/mgr/test/src/sta_mgr.c
+++ b/cesar/cp/sta/mgr/test/src/sta_mgr.c
@@ -656,23 +656,20 @@ test_case__cp_sta_manager_garbage (test_t test)
for (i = 0; i < 10; i++)
{
sta = cp_sta_mgr_sta_add (&cp, net1, i + 1, i + 1);
- sta->last_seen_ms = cp_sta_core_get_date_ms (&cp)
- - MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S) ;
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS;
slab_release (sta);
sta = cp_sta_mgr_sta_add (&cp, net2, i + 1, (i + 1) * 20);
- sta->last_seen_ms = cp_sta_core_get_date_ms (&cp)
- - MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S) ;
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS;
slab_release (sta);
}
/* Release the stations. */
cp_sta_mgr_garbage (&cp);
- test_fail_if (set_empty (&net1->associated_stas));
- test_fail_if (set_empty (&net2->associated_stas));
- test_fail_if (set_empty(&cp.sta_mgr.stas));
-
- test_sta_mgr_uninit (&cp);
+ test_fail_unless (cp_sta_mgr_net_list_is_empty (&cp));
+ cp_sta_mgr_uninit (&cp);
}
test_end;
@@ -739,8 +736,8 @@ test_case__cp_sta_manager_garbage (test_t test)
net = cp_sta_mgr_add_avln (&cp, 1, 1);
/* Add some stations in the first AVLN. */
sta = cp_sta_mgr_sta_add (&cp, net, 1, 1);
- sta->last_seen_ms = cp_sta_core_get_date_ms (&cp)
- - MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S) - 10;
+ sta->expired_date_ms = cp_sta_core_get_date_ms (&cp)
+ - HPAV_DISCOVERED_LIST_EXPIRE_TIME_MS - 10;
slab_release (sta);
/* Set our AVLN. */
cp_sta_mgr_set_our_avln (&cp, net);