Progress reportThis week I took care of communication ID collisions. Since the ID is 4 bytes long there could be collisions as the number of users grow. For 4,000 users the chance is one in a million, but for 4 million, it's one in a thousand.
Previously I left this to be dealt with in the future versions, but since commands are now a documented interface, I had to think how to handle collisions and implement the solution.
By the way, I could have probably saved myself about a month of work if I didn't bother to encrypt packets, like all the other coins don't.
It's one of those tasks that seem relatively simple to a regular person ("You just need to call something like encrypt(packet) and that's it, right? How hard could that be?"), but prove to be much more complicated in reality. Because before you can call encrypt(), you need to get a key and this unfolds a whole chain of events and problems. I might tell you more about it one day
But anyway, I found more or less simple ways to deal with all the complexities, so now collisions are taken care of.
--
Spent some time adding automatic indentation to wiki sections. Some articles became quite large and difficult to read. So had to figure a way to do it.
--
I will post the new roadmap once the refactoring is complete, but in general I am at the stage where most of the things kinda work, but there's still a gazillion of small tasks to be done.
This is Simcoin right now:
You can see the whole building, but still need to lay thousands of small bricks to fill the walls.
And here's how software development works:
Most indie projects fail in the Q point, when the going gets tough. You see it all the time – a few young hotheads gather together and decide to do a super cool game and in a couple of weeks they post cool screenshots, which look
almost like a complete game. And then it never goes anywhere beyond that point and project members get frustrated and quit.
Why? Precisely because of that graph. You work and work and nothing seems to happen and it feels like you're stuck and will never finish it.
Here are just some recently closed items from my to-do list:
+ Tasks::add(): protection against null pointers.
+ BUG FIXED: Incorrect check "!find()" for array when it returns 'int' instead of 'bool'.
+ BUG FIXED: Can't init TaskDesc before inserting! Otherwise it references itself by ID and it's not in array yet.
+ BUG FIXED: set 'done' to 'true' in Tasks constructor, otherwise init() will wait N seconds for the non-existent thread to finish
+ Set reason in sim.quit() and don't reset it for 'quit' command, so we could return errors this way.
+ Move socket and NetStats from Packet into T_Net.
+ Bruteforce ID collisions in Tasks::add(), otherwise every 16 M tasks there might be a problem...
+ Suicide tasks a bit differently. 'dead' array.
+ INI: Remove the variable if an empty string passed.
+ KVS walk functions. dump(). Bug fixes. Big endian keys, key size added for that.
+ "OK" reason to mark processed command.
+ Sending sim.quit() in on_exit handler.
+ 'level' parameter for sim.start_task.
+ Default level for tasks into task factory.
+ CmdLog: add indent.
+ BUG FIXED: outgoing() pass wasn't executed for orphaned commands, this could lead to wrong indent in CmdLog because incoming() wasn't paired.
+ Tasks::print()
+ BUG FIXED: 'quit' message must be sent only in one pass.
+ SimApi::out_raw_packet.
+ 'bool4' type for commands to make misalignment less probable.
+ 'is_node' into 'comm_key' command.
+ BUG FIXED: outgoing task no was 1 more than it should, because after the loop it's invalid. And also if you processed a command you shouldn't receive outgoing() call anyway.
+ BUG FIXED: outgoing must cycle till "i >= 0" instead of "i > 0". D'oh!
+ BUG FIXED: Tasks::add("") didn't set the level and it also didn't set it properly. 2-in-1 bug.
+ Client's data path from DLL path.
+ Rename 'hash' into 'hmac4' and use 4 bytes instead of 3. Update wiki.
+ Triage::get_peer() that will deal with comm_key event/adding internally.
+ KPS::next().
+ Change Triage to use next() to cycle through all keys and decode proper one.
+ Damn, 'account' and 'is_node' must be returned for each key!
+ operator == to Hash32. Store hmac in vault as Hash32 instead of byte[32]. Need to convert everywhere.
+ Hash32: added a bunch of functions to support "Hash32().add(prefix).add(msg,size).calc();" style of programming.
+ Hash32: zero buffer after stretch() to clear passwords.
+ Tasks::add(): don't add tasks if quitting.
And it goes on and on and on…
The to-do text file is already 329 Kb in size!
There's no other way than to just grit your teeth and keep going...