예제 #1
0
파일: Node.cs 프로젝트: mikeblakeuk/MNP
        private void UpdateCacheWithFullUpdate(byte[] data)
        {
            if (data == null || data.Length == 0)
            {
                throw new ArgumentException("The specified data was not valid", "data");
            }

            lock (ResultCache)
            {
                ResultCache = CacheSerialiser.Deserialise(data);
            }
        }
예제 #2
0
파일: Node.cs 프로젝트: mikeblakeuk/MNP
        private void SendFullCacheUpdate(IPAddress ip)
        {
            if (ip == null)
            {
                throw new ArgumentException("The specified IP address is not valid", "ip");
            }

            if (!KnownNodes.Contains(ip))
            {
                throw new ArgumentException("The ip address specified is not known.", "ip");
            }

            // grab a copy of the cache
            CacheProvider <string, ClientResultMessage> temp = ResultCache;

            temp.ClearSubscribersNoNotify();
            InterNodeCommunicationMessage msg = new InterNodeCommunicationMessage {
                Data = CacheSerialiser.Serialise(temp), IsLocalOnly = true, MessageType = InterNodeMessageType.FullCacheUpdateReceived
            };

            SendToNode(ip, InterNodeCommunicationMessageSerialiser.Serialise(msg));
        }