public override void Open() { base.Open(); if (mindupes > 0) { foreach (SlaveInfo slave in dslaves) { slave.nstm.WriteByte((byte)'M'); DistObject.ToBytes(mindupes, buf, 0); XContent.SendXContent(slave.nstm, buf, 4); } } }
public virtual void Add(int a, int b) { if (!didopen) { throw new Exception("Must Open before writing to Hashtable"); } B8 b8; // = new B8(a, b); b8.A = a; b8.B = b; //b8.CopyToArray(buf); //int slaveID = DetermineSlave(buf, 8); int slaveID = ((b8.A ^ b8.B) & 0x7FFFFFFF) % dslaves.Count; /*if (slaveID < 0 || slaveID >= dslaves.Count) * { * throw new Exception("Slave missing: slaveID needed: " + slaveID.ToString()); * }*/ SlaveInfo slave = dslaves[slaveID]; lock (slave) { if (addbufinitsize > 0) { BufSlaveInfo bslave = (BufSlaveInfo)slave; bslave.EnsureAddBuf_unlocked(addbufinitsize); b8.CopyToArray(buf); bslave.AddBuf_unlocked(buf, 8); } else { // 'P' for publish/put slave.nstm.WriteByte((byte)'P'); DistObject.ToBytes(Int32.MaxValue, buf, 0); XContent.SendXContent(slave.nstm, buf, 4); b8.CopyToArray(buf); XContent.SendXContent(slave.nstm, buf, 8); // Note: no confirmation } } }