Skip to content

Development#47

Merged
DannyArends merged 34 commits intomasterfrom
development
Mar 20, 2026
Merged

Development#47
DannyArends merged 34 commits intomasterfrom
development

Conversation

@DannyArends
Copy link
Copy Markdown
Owner

@DannyArends DannyArends commented Mar 20, 2026

Architecture

  • Server no longer inherits Thread - accept loop runs on main thread, server.run() blocks directly
  • Client no longer inherits Thread - connection handling is now a plain function call
  • ClientInterface removed - only one implementor, interface was dead weight
  • New WorkerPool - 200 pre-allocated threads replace unbounded per-connection thread spawning, fixing the VmSize growth that caused Error creating thread under load

Security

  • safePath - non-existent paths now check parent directory inside root, closing a symlink TOCTOU gap on shared hosting
  • acme.d - hardcoded email replaced with serverConfig.get("user_email", "")

Graceful shutdown

  • SIGTERM and SIGINT handled in signals.d via shutdownSignal flag
  • Server.alive() checks the flag - loop exits cleanly, pool drains, sockets close

Configuration

  • New www/server.config - all tunable constants (pool size, request limits, timeouts, server identity) now live in one file
  • ServerConfig struct in webconfig.d shares the same string[string] parser as WebConfig
  • Thread-safe get() method with mutex and fallback defaults
  • All immutable constants removed from workerpool.d, client.d, process.d, https.d, response.d, acme.d

Code cleanup

  • parseKeyInput / keyoff removed
  • stop() removed from Server - shutdown flows through run() → alive() → pool.stop()
  • Error-response helpers moved from client.d to interfaces.d and renamed
  • logConnection moved inside Client
  • setLimit() moved into signals.d as setupPosix()
  • imports.d - Semaphore added for WorkerPool

Files added: danode/workerpool.d, www/server.config

@DannyArends DannyArends merged commit fff2f2c into master Mar 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant