Commit Graph
12 Commits
Author SHA1 Message Date
cozis 49091aff6d Document communication between metadata server and clients in the misc/PROTOCOL.txt file and add generation counters for files 2025-11-24 13:04:29 +01:00
Claudeandcozis 3b0ef325fa Fix web server hanging issues
Fixed two bugs in the HTTP server that could cause hangs:

1. web/chttp.c:4060 - Fixed incorrect error buffer check
   - Was checking output buffer for errors after a read operation
   - Should check input buffer instead
   - This could cause the server to miss read errors and not close
     bad connections properly

2. web/main.c:334 - Added loop to process multiple queued requests
   - Previously only processed one request per event loop iteration
   - Now processes all queued requests before returning to poll()
   - This prevents requests from being stuck in the queue when the
     socket is in ESTABLISHED_READY state

These fixes improve the server's ability to handle multiple requests
on Keep-Alive connections.
2025-11-23 09:48:07 +01:00
cozis e99c574767 Add options --reuse-addr and --trace-bytes to toastyfs_web 2025-11-23 09:08:45 +01:00
Claudeandcozis cc758a5d3a Add web server to cluster demo and fix port bug
- Add web server integration to cluster_demo.sh script
  - Configure web server port (8090)
  - Update build_if_needed() to check for toastyfs_web binary
  - Add get_web_binary() function
  - Start web server after chunk servers
  - Update status display to show web server
  - Update help text to show HTTP interface

- Fix bug in web/main.c where --local-port incorrectly set
  upstream_port instead of local_port

The cluster demo now starts a full cluster with:
- Metadata server on port 8080 (ToastyFS protocol)
- N chunk servers starting from port 8081
- Web server on port 8090 (HTTP interface)
2025-11-23 09:03:13 +01:00
cozis 0dbb5b1fc5 Add command-line arguments to toastyfs_web 2025-11-23 00:46:27 +01:00
cozis d7a2262172 Fix compilation errors of the web interface 2025-11-22 23:59:08 +01:00
Claude f856bd0e05 Track actual bytes read in read operations
Add functionality to determine the actual number of bytes read during
read operations, making it possible to detect when a read was truncated
because it went past the end of the file.

Changes:
- Modified file_tree_read() to calculate and return actual_bytes via
  new output parameter
- Updated metadata server to send actual_bytes in READ_SUCCESS messages
- Added bytes_read field to ToastyResult structure
- Modified client to parse, store, and report actual bytes read
- Updated toasty_read() to return the actual number of bytes read
  instead of always returning 0
- Fixed web server to use bytes_read field instead of non-existent
  count field

This allows clients to distinguish between:
- Reading zeros because the file is sparse (has holes)
- Reading past the end of the file (truncated read)
2025-11-22 22:22:43 +00:00
cozis b930ba08e3 Add the ability to associate an opaque user pointer to a ToastyHandle which is then returned in its associated ToastyResult 2025-11-22 23:09:31 +01:00
cozis e1fa3729c6 Drop the MAX_CONNS macro and define TCP_CONNECTION_LIMIT, TCP_POLL_CAPACITY, TCP_EVENT_CAPACITY instead 2025-11-22 22:59:32 +01:00
cozis 582893be70 Add notes on the HTTP's interface semantics 2025-11-22 13:13:10 +01:00
cozis b2b1ed540b Update cHTTP and rewrite web/main.c 2025-11-22 12:30:47 +01:00
cozis 747f851155 Draft of the REST server client using cHTTP 2025-11-20 10:50:55 +01:00