// Handle timer routines static public void onUpdate(object source, ElapsedEventArgs e) { // Update the friendlist FriendList.Update(); // Cleanup the presence list // TODO: optimize this by using a different thread perhaps PresenceList.performCleanup(); if (Node.walletStorage.getPrimaryAddress() == null) { return; } if (PresenceList.curNodePresence == null) { PresenceList.generatePresenceList("spixi:000", 'C'); // TODO TODO TODO TODO spixi:000 is used only for tech preview and will later be replaced with something more secure } // Request wallet balance using (MemoryStream mw = new MemoryStream()) { using (BinaryWriter writer = new BinaryWriter(mw)) { writer.Write(Node.walletStorage.getPrimaryAddress().Length); writer.Write(Node.walletStorage.getPrimaryAddress()); NetworkClientManager.broadcastData(new char[] { 'M' }, ProtocolMessageCode.getBalance, mw.ToArray(), null); } } }
// Handle timer routines static public void onUpdate(object source, ElapsedEventArgs e) { // Update the friendlist FriendList.Update(); // Cleanup the presence list // TODO: optimize this by using a different thread perhaps PresenceList.performCleanup(); if (Node.walletStorage.getPrimaryAddress() == null) { return; } // Request wallet balance using (MemoryStream mw = new MemoryStream()) { using (BinaryWriter writer = new BinaryWriter(mw)) { writer.Write(Node.walletStorage.getPrimaryAddress().Length); writer.Write(Node.walletStorage.getPrimaryAddress()); NetworkClientManager.broadcastData(new char[] { 'M' }, ProtocolMessageCode.getBalance, mw.ToArray(), null); } } }
// Handle timer routines static public void onUpdate(object source, ElapsedEventArgs e) { // Update the friendlist FriendList.Update(); // Cleanup the presence list // TODO: optimize this by using a different thread perhaps PresenceList.performCleanup(); if (Node.walletStorage.getPrimaryAddress() == null) { return; } if (Config.enablePushNotifications) { OfflinePushMessages.fetchPushMessages(); } // Request initial wallet balance if (balance.blockHeight == 0 || balance.lastUpdate + 300 < Clock.getTimestamp()) { using (MemoryStream mw = new MemoryStream()) { using (BinaryWriter writer = new BinaryWriter(mw)) { writer.Write(Node.walletStorage.getPrimaryAddress().Length); writer.Write(Node.walletStorage.getPrimaryAddress()); NetworkClientManager.broadcastData(new char[] { 'M' }, ProtocolMessageCode.getBalance, mw.ToArray(), null); } } } }
// Handle timer routines static public void mainLoop() { byte[] primaryAddress = IxianHandler.getWalletStorage().getPrimaryAddress(); if (primaryAddress == null) { return; } byte[] getBalanceBytes; using (MemoryStream mw = new MemoryStream()) { using (BinaryWriter writer = new BinaryWriter(mw)) { writer.WriteIxiVarInt(primaryAddress.Length); writer.Write(primaryAddress); } getBalanceBytes = mw.ToArray(); } while (running) { try { // Update the friendlist FriendList.Update(); // Request initial wallet balance if (balance.blockHeight == 0 || balance.lastUpdate + 300 < Clock.getTimestamp()) { CoreProtocolMessage.broadcastProtocolMessage(new char[] { 'M', 'H' }, ProtocolMessageCode.getBalance2, getBalanceBytes, null); } if (Config.enablePushNotifications) { OfflinePushMessages.fetchPushMessages(); } // Cleanup the presence list // TODO: optimize this by using a different thread perhaps PresenceList.performCleanup(); } catch (Exception e) { Logging.error("Exception occured in mainLoop: " + e); } Thread.Sleep(2500); } }