-- Leo's gemini proxy

-- Connecting to ainent.xyz:1965...

-- Connected

-- Sending request

-- Meta line: 20 text/gemini; charset=utf-8; lang=en

smolver development log, part 6


Intro


This is the sixth in a planned series of posts (well, seventh if you count the announcement) where I'll share my experience writing smolver, my Gemini server software, written in Swift.


You can find the previous iterations below. This series has become long enough that I've added a dedicated page for it:


smolver Devlog


Hopefully this post makes sense. I am tired tonight and so don't have the energy to proofread more than once.


Betas 1 & 2


What's changed?


Fix crash when getting too many connections too quickly in succession

Provide a quick bandaid for when an SSL issue occurred that was causing the server to become unresponsive

Fix copyright notice in 2 files

Add copyright notice to 2 files missing it

Log requests that cause a 44 SLOW DOWN (rate limiting); before, it was only logging the response

Tweak log layout of requests and response so it's clearer at a glance which is which

Tweak wording on some other logs

Bumped the message for when a client requests a directory root from debug to informational

Expand backlog

Remove plans for using an ini file for configuration over the current json - K.I.S.S. (Keep It Simple, Stupid) principle

Remove plans for providing opt-in syntax validation of all served text/gemini files - again, K.I.S.S

Slight reorganization to backlog, made it clearer which I intend to implement as a sort of static site generator, outside of the scope of smolver itself - yet again, the K.I.S.S. principle

Decided against enhancing the redirect configuration (redirecting an entire directory at once) that I mentioned in the previous post; on further thought, that one failed the cost / benefit analysis as Gemini discourages redirects anyway, and it's not like I have dozens of files all being rearranged. At this time, not worth the time to develop and test. May possibly revisit in future.

Decided against enhancing the redirect configuration (redirection for a renamed directory) that I mentioned in the previous post; on further thought, the current implementation makes more sense, just keep the .smol.json (config file) where the old directory is

Reprioritized the bug where directories named with a period and containing an index file will not redirect to root (/) if requested without the trailing slash (/); on further thought, this is really no big deal, so repriorited for later

Made list of all errors ever reported in the logs, put in backlog to triage for beta 3

Researched an issue in the log files where sometimes files with gibberish names were being created. Root cause turned out to be, long story short, Swift's atomic file writing operations working exactly as expected, and file writes just so happening to happen at the same time that the server shut itself off upon detecting a problem. This auto-shutdown is just a bandaid and I've scheduled the real fixes for beta 3, at which point these files should stop appearing.

Cleanup install script

Cleanup systemd service file

Ran the Gemini server stress test against the codebase, made list of findings to triage, which I've scheduled for beta 4


Some of the logging tweaks were to make it so that the things that I suspected in the last post were more clear that they weren't actually happening.


What I've decided since then


I am beginning to remove plans for some features I had implemented, and to delay fixing the one known low-impact bug. Partially out of laziness (a virtue in programming!), and partially out of wanting to keep it simple and follow the UNIX philosophy: do one thing and one thing only, and do it well.


Thoughts


Overall, the total lines of code grew only a little bit this time. Running cloc on v0.0.19 returns:


cloc Sources
      12 text files.
      12 unique files.
       0 files ignored.

github.com/AlDanial/cloc v 1.86  T=0.08 s (145.9 files/s, 19287.3 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Swift                           12            201            310           1075
-------------------------------------------------------------------------------
SUM:                            12            201            310           1075
-------------------------------------------------------------------------------

Running cloc on v0.2.0 returns:


cloc Sources
      12 text files.
      12 unique files.
       0 files ignored.

github.com/AlDanial/cloc v 1.86  T=0.08 s (154.2 files/s, 20436.3 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
Swift                           12            202            312           1076
-------------------------------------------------------------------------------
SUM:                            12            202            312           1076
-------------------------------------------------------------------------------

These numbers do not include dependencies.


That is a growth of a whopping 1 line. I was a bit surprised to see this, but as the only changes were either to the backlog or to logging, it makes sense because I only added one new log and the rest were tweaking existing items.

-- Response ended

-- Page fetched on Tue May 21 10:32:44 2024