public Engine(PastryRealNode n, IPastryNode joinOtherPastryNode) { /* * self = n; * try * { * selfPastryNodeBasic = new Tashjik.Common.PastryNodeBasic(Tashjik.Common.UtilityMethod.GetLocalHostIP()); * } * catch (Tashjik.Common.Exception.LocalHostIPNotFoundException e) * { * //local ip could not be found :O :O * //crash the system * //dunno how to do it though :( * } * * initialize(); * joinOther(joinOtherPastryNode); */ }
private static int sharedPrefixLength(PastryRealNode n, byte[] hash) { byte[] PastryNodeHashedIP = n.getHashedIP(); int maxLength = PastryNodeHashedIP.Length; int prefixCount = 0; if (hash.Length > maxLength) { maxLength = hash.Length; } for (int i = 0; i < maxLength; i++) { if (PastryNodeHashedIP[i] != hash[i]) { break; } prefixCount++; } return(prefixCount); }
public Engine(PastryRealNode n) { self = n; try { selfPastryNodeBasic = new Tashjik.Common.NodeBasic(Tashjik.Common.UtilityMethod.GetLocalHostIP()); } catch (Tashjik.Common.Exception.LocalHostIPNotFoundException e) { //local ip could not be found :O :O //crash the system //dunno how to do it though :( } //routingTable = new PastryNodeEntry[(int) (Math.Pow(2, b)-1), 128/b]; //smallerLeafSet = new List<PastryNodeEntry>(L/2); //largerLeafSet = new List<PastryNodeEntry>(L/2); initialize(); }
public Engine(PastryRealNode n, IPastryNode joinOtherPastryNode) { /* self = n; try { selfPastryNodeBasic = new Tashjik.Common.PastryNodeBasic(Tashjik.Common.UtilityMethod.GetLocalHostIP()); } catch (Tashjik.Common.Exception.LocalHostIPNotFoundException e) { //local ip could not be found :O :O //crash the system //dunno how to do it though :( } initialize(); joinOther(joinOtherPastryNode); */ }
private static int sharedPrefixLength(PastryRealNode n, byte[] hash) { byte[] PastryNodeHashedIP = n.getHashedIP(); int maxLength = PastryNodeHashedIP.Length; int prefixCount = 0; if(hash.Length > maxLength) maxLength = hash.Length; for(int i=0; i<maxLength; i++) { if(PastryNodeHashedIP[i]!= hash[i]) break; prefixCount++; } return prefixCount; }