new framework

This commit is contained in:
2026-05-12 22:15:07 +02:00
parent be21826ecc
commit 953498a62d
24 changed files with 2410 additions and 180 deletions

View File

@@ -12,13 +12,19 @@ module BBS
server = TCPServer.new('0.0.0.0', @port)
puts "BBS listening on port #{@port} — connect with: telnet localhost #{@port}"
loop do
client = server.accept
client = begin
server.accept
rescue Errno::ECONNABORTED, Errno::EMFILE, Errno::ENFILE, IOError => e
warn "BBS accept error: #{e.class}: #{e.message}"
next
end
Thread.new(client) do |c|
session = Session.new(c)
begin
session.run
rescue => e
nil
rescue StandardError => e
warn "BBS session error: #{e.class}: #{e.message}\n#{e.backtrace.first(3).join("\n")}"
ensure
BBS.config.on_session_end&.call(session)
end