Merged the secident code to CVS now, along with bunch of other fixes. Here's the list:
- [core] Some platforms (e.g. linux) don't support renaming files across platforms; use explicit copy + delete if rename fails during file completing (e.g. when temp/incoming are on diff partitions)
- [ed2k] Cleanup servers on shutdown
- [ed2k] Better formatting of ServerMessage if many messages are received in row
- [core] API addition: Utils::putVal, accepting pointer to uint8_t array
- [core] API change: Hash::getLength() renamed to Hash::size() to be closer to STL naming style.
- [ed2k] SecIdentState, PublicKey and Signature packets implemented
- [ed2k] PublicKey class implemented; uses implict data sharing and raw uint8_t array for implementation to provide best memory/speed (std::string would have memory overhead, and Hash wouldn't allow runtime-detected size).
- [ed2k] Secure Client Identification support
- [ed2k] Do cleanup in ClientList on shutdown
- [ed2k] All constants (e.g. timeouts etc) used in inter-client communication are now declared in single place, and fully documented, allowing easier tweaking.
- [ed2k] LowID callbacks timeout increased to 60 seconds.
- [ed2k] Ensure that we NEVER EVER try to reask more than once during SOURCE_REASKTIME timeframe (default is 30 minutes)
- [ed2k] All information (that is needed) is now copied over during client merging (formerly some info was left behind to the dead client)
- [ed2k] During client destruction, handle exceptions coming from PartData::delSourceMask()
Now, the implementation uses cryptopp lib, but we have a subset of cryptopp now in modules/ed2k dir - cryptopp.cpp and cryptopp.h. However, those two files will need a lot of processing, because:
- They total 16'000 sloc, and add 800kb to binary size in release build (2-3 mb in debug build)
- They don't conform to hydranode coding standards
- They don't compile with -pedantic flag (enforces strict ISO C++)
- They spit out ~500 lines of warnings when compiled with full warnings turned on (-W -Wall)
- They break (crash the app) when compiled with optimizations (-O3, probably with -O2 too)
The basic idea is to get rid of all the libraries intermediate classes, and leave only the actual classes we use. There's a huge class hierarchy behind all that, which is no doubt useful when dealing with full library, however is completely irrelevant for us, since we technically only use a few classes. So I'm hoping to reduce the code size at least 50%, perhaps even more. And with that code size reduction, the crashes with optimizations can also be addressed.
Madcat, ZzZz
PS: The last patchset (excluding crypto lib code) was +800 sloc, raising our (own) codebase finally above the 30'000 sloc line. We were close to 30'000 once before - cpl months ago - but then I basically thew away / replaced ton of code, dropping us down to 26k region. But now we'r back, and exceeded the 30k mark for the first time :)