Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Oops, forgot to update these. Commit fix.

  • Loading branch information...
commit 6df3d5393ab4340cbc2bfb278c0c6cee0880fa5f 1 parent 729b6c5
Péter Szilágyi karalabe authored
Showing with 20 additions and 19 deletions.
  1. +13 −13 config/config_test.go
  2. +7 −6 proto/carrier/heart.go
26 config/config_test.go
View
@@ -98,26 +98,26 @@ func TestPack(t *testing.T) {
}
}
-func TestOverlay(t *testing.T) {
+func TestPastry(t *testing.T) {
// Ensure pastry space is reduced size (at least issue a warning)
- if OverlaySpace != 40 {
- t.Errorf("config (overlay): address space is invalid: have %v, want %v.", OverlaySpace, 40)
+ if PastrySpace != 40 {
+ t.Errorf("config (overlay): address space is invalid: have %v, want %v.", PastrySpace, 40)
}
- if size := OverlayResolver().Size() * 8; size < OverlaySpace {
- t.Errorf("config (overlay): resolver does not output enough bits for space: have %v, want %v.", size, OverlaySpace)
+ if size := PastryResolver().Size() * 8; size < PastrySpace {
+ t.Errorf("config (overlay): resolver does not output enough bits for space: have %v, want %v.", size, PastrySpace)
}
// Do some sanity checks on the parameters
- if OverlayBase < 1 {
- t.Errorf("config (overlay): invalid base bits: have %v, want min 1.", OverlayBase)
+ if PastryBase < 1 {
+ t.Errorf("config (overlay): invalid base bits: have %v, want min 1.", PastryBase)
}
- if OverlaySpace%OverlayBase != 0 {
- t.Errorf("config (overlay): address space is not divisible into bases: %v %% %v != 0", OverlaySpace, OverlayBase)
+ if PastrySpace%PastryBase != 0 {
+ t.Errorf("config (overlay): address space is not divisible into bases: %v %% %v != 0", PastrySpace, PastryBase)
}
- if OverlayLeaves != 1<<uint(OverlayBase-1) && OverlayLeaves != 1<<uint(OverlayBase) {
- t.Errorf("config (overlay): invalid leave set size: have %v, want %v or %v.", OverlayLeaves, 1<<uint(OverlayBase-1), 1<<uint(OverlayBase))
+ if PastryLeaves != 1<<uint(PastryBase-1) && PastryLeaves != 1<<uint(PastryBase) {
+ t.Errorf("config (overlay): invalid leave set size: have %v, want %v or %v.", PastryLeaves, 1<<uint(PastryBase-1), 1<<uint(PastryBase))
}
// Make some trivial checks for the tuning parameters
- if OverlayNetBuffer < 16 || OverlayNetBuffer > 128 {
- t.Errorf("config (overlay): strange network buffer size: have %v, want from [16..128].", OverlayNetBuffer)
+ if PastryNetBuffer < 16 || PastryNetBuffer > 128 {
+ t.Errorf("config (overlay): strange network buffer size: have %v, want from [16..128].", PastryNetBuffer)
}
}
13 proto/carrier/heart.go
View
@@ -23,9 +23,10 @@
package carrier
import (
- "github.com/karalabe/iris/config"
"log"
"math/big"
+
+ "github.com/karalabe/iris/config"
)
// Load report between two carrier nodes.
@@ -36,19 +37,19 @@ type report struct {
// Adds the node within the topic to the list of monitored entities.
func (c *carrier) monitor(topic *big.Int, node *big.Int) error {
- id := new(big.Int).Add(new(big.Int).Lsh(topic, uint(config.OverlaySpace)), node)
+ id := new(big.Int).Add(new(big.Int).Lsh(topic, uint(config.PastrySpace)), node)
return c.heart.Monitor(id)
}
// Remove the node of a specific topic from the list of monitored entities.
func (c *carrier) unmonitor(topic *big.Int, node *big.Int) error {
- id := new(big.Int).Add(new(big.Int).Lsh(topic, uint(config.OverlaySpace)), node)
+ id := new(big.Int).Add(new(big.Int).Lsh(topic, uint(config.PastrySpace)), node)
return c.heart.Unmonitor(id)
}
// Updates the last ping time of a node within a topic.
func (c *carrier) ping(topic *big.Int, node *big.Int) error {
- id := new(big.Int).Add(new(big.Int).Lsh(topic, uint(config.OverlaySpace)), node)
+ id := new(big.Int).Add(new(big.Int).Lsh(topic, uint(config.PastrySpace)), node)
return c.heart.Ping(id)
}
@@ -96,8 +97,8 @@ func (c *carrier) Beat() {
// topic member nodes.
func (c *carrier) Dead(id *big.Int) {
// Split the id into topic and node parts
- topic := new(big.Int).Rsh(id, uint(config.OverlaySpace))
- node := new(big.Int).Sub(id, new(big.Int).Lsh(topic, uint(config.OverlaySpace)))
+ topic := new(big.Int).Rsh(id, uint(config.PastrySpace))
+ node := new(big.Int).Sub(id, new(big.Int).Lsh(topic, uint(config.PastrySpace)))
// Depending on whether it was the topic parent or a child reown or unsub
c.lock.RLock()
Please sign in to comment.
Something went wrong with that request. Please try again.