internal override void ReceiveTotalOrder(TotalOrderData totalorderData) { int requestId = totalorderData.RequestId; Utils.Print(" [*] SMR Server: Received TotalOrderData.", verbose: Verbose); if (holdbackQueue.ContainsKey(requestId)) { int totalorderId = totalorderData.TotalOrderId; if (totalorderId < rg) { Utils.Print(" [x] SMR Server: Received unexpected TotalOrderData."); } else if (totalorderId > rg) { deliveryQueue.Add(requestId, totalorderData); } else { ExecuteRequest(requestId); } } else { deliveryQueue.Add(requestId, totalorderData); } }
internal void CheckDeliveryQueue() { Utils.Print(" [*] SMR Server: Checking Delivery Queue.", verbose: Verbose); //Checks if any of the request's whose TotalOrderId came earlier can be executed now. foreach (int requestId in deliveryQueue.Keys) { TotalOrderData totalorderData = deliveryQueue[requestId]; int totalorderId = totalorderData.TotalOrderId; //If the totalorderId of the next request to be executed is there, checks if the request is in holdback. if (totalorderId == rg) { //If both the totalorderId and the request are in the server, executes, and recursively checks if the next are. if (holdbackQueue.ContainsKey(requestId)) { ExecuteRequest(requestId); } return; } } }
internal void SendTotalOrder(string clientId, int requestId) { bool goingNewView = false; mIdTable[clientId] = requestId; TotalOrderData totalorderData = new TotalOrderData(requestId, sg); sg += 1; List <ServerData> replicasList = viewManager.GetKnownReplicas(); foreach (ServerData serverData in replicasList) { string serverProxyURL = $"tcp://{serverData.ServerURL}/{serverData.ServerName}"; try { ISMRServerService serverProxy = (ISMRServerService)Activator.GetObject(typeof(ISMRServerService), serverProxyURL); serverProxy.ReceiveTotalOrder(totalorderData); } catch (RemotingException) { goingNewView = true; break; } catch (SocketException) { goingNewView = true; break; } } if (goingNewView) { viewManager.TryViewChange(viewManager.GetKnownReplicas()); } Utils.Print("[*] SMR Server Sequencer: Sent TotalOrderData."); CheckHoldbackSequencerQueue(); //Checks if there are any messages than can be attributed now. }
internal abstract void ReceiveTotalOrder(TotalOrderData totalorderData);
public void ReceiveTotalOrder(TotalOrderData totalorderData) => server.ReceiveTotalOrder(totalorderData);
// Does nothing, only here because it was needed for SMR and the interface is shared. internal override void ReceiveTotalOrder(TotalOrderData totalorderData) => throw new System.NotImplementedException();