Commit Graph
234 Commits
Author SHA1 Message Date
cozis 9ea4ee5223 Remove solved TODO from TODO.txt and fix a bug in file_tree_read 2025-11-10 12:51:12 +01:00
cozis 9cdf636eb6 Bug fix 2025-11-10 12:41:18 +01:00
cozis 36925309da Bug fix 2025-11-10 12:26:25 +01:00
cozis 62d7439ddd Set sockets as non-blocking and fix chunk server timeout 2025-11-09 21:30:22 +01:00
Francesco CozzutoandGitHub 99c406fbe5 Merge pull request #9 from cozis/claude/set-sockets-nonblocking-011CUxtZsiieE2szQupw9Ghm
Set sockets as non-blocking in tcp.c and add blocking checks
2025-11-09 20:52:50 +01:00
Claude 1a2c02203d Set sockets as non-blocking in tcp.c and add blocking checks
Changes:
- Added is_nonblocking flag to Descriptor structure in system.c
- Implemented mock_fcntl (Linux) and mock_ioctlsocket (Windows) to handle setting sockets as non-blocking
- Set all sockets as non-blocking in tcp.c:
  - Listen sockets in create_listen_socket()
  - Accepted sockets in tcp_translate_events()
  - Connecting sockets in tcp_connect()
- Added checks in mock_accept(), mock_recv(), and mock_send() to abort the simulation if a socket would block but is not configured as non-blocking
- This ensures proper non-blocking socket configuration and helps catch blocking socket errors during simulation
2025-11-09 19:51:09 +00:00
cozis bab8558511 Progress 2025-11-09 20:36:08 +01:00
cozis d13ad3ae6c Progress 2025-11-09 19:43:24 +01:00
cozis ecef79cc53 Progress 2025-11-09 19:06:23 +01:00
cozis bf1a18b9d0 Progress 2025-11-09 18:19:17 +01:00
cozis 753aba9e63 Progress 2025-11-09 17:39:53 +01:00
Francesco CozzutoandGitHub 058b03ba53 Merge pull request #8 from cozis/claude/remove-simulated-time-var-011CUxaeDKCx1PPFbXjhj7p3
Remove simulated_time variable and use current_time instead
2025-11-09 16:52:58 +01:00
Claude 8ec512e3ce Remove simulated_time variable and use current_time instead
- Removed simulated_time struct timespec variable
- Updated mock_QueryPerformanceCounter to convert current_time (nanoseconds) to performance counter ticks
- Updated mock_clock_gettime to convert current_time (nanoseconds) to timespec format
- All time tracking now uses the unified current_time variable
2025-11-09 15:51:39 +00:00
cozis 5f018c18b4 Progress 2025-11-09 16:49:15 +01:00
cozis 3d1368938b Progress 2025-11-09 16:20:50 +01:00
cozis 8d56a32bd1 Progress 2025-11-09 14:32:02 +01:00
cozis bc12f86598 Progress 2025-11-09 14:15:19 +01:00
cozis d2140bdb13 Progress 2025-11-09 14:12:19 +01:00
cozis c3e20eceef Progress 2025-11-09 13:20:04 +01:00
cozis 7282176a9c Progress 2025-11-09 12:58:17 +01:00
cozis a2e949e5e4 Progress 2025-11-09 12:51:51 +01:00
cozis 739d6a7aee Progress 2025-11-09 12:08:22 +01:00
cozis 88735d1595 Progress 2025-11-08 23:44:37 +01:00
Francesco CozzutoandGitHub f335c6f329 Merge pull request #7 from cozis/claude/fix-as-011CUw81oePGJUvH3eAuvBjP
Claude
2025-11-08 22:36:07 +01:00
cozis 537fbc655f Progress 2025-11-08 22:35:20 +01:00
Claude 9367202dbc Fix assertion failures in tinydfs_test
Fixed two critical bugs in the TinyDFS client code:

1. Added bounds checking in alloc_operation() to prevent buffer overflow
   when searching for a free operation slot. The while loop could go past
   the end of the operations array, causing undefined behavior.

2. Fixed all tinydfs_submit_* functions to return the operation index
   (opidx) instead of 0 on success. This was causing all operations to
   be tracked with index 0, leading to type mismatches between operation
   types and result types, which triggered the assertion:
   "Assertion `pending.type == PENDING_OPERATION_DELETE' failed"

The test now runs successfully past the original assertion point.
2025-11-08 21:28:27 +00:00
cozis 554f92c8bc Merge branch 'main' of https://github.com/cozis/TinyDFS 2025-11-08 22:17:26 +01:00
cozis c2cb833e50 Progress 2025-11-08 22:16:55 +01:00
Francesco CozzutoandGitHub 94541b8770 Merge pull request #6 from cozis/claude/fix-valgrind-errors-011CUvinWp4yT3NTHZpayAUr
Fix Valgrind Memory Errors
2025-11-08 17:35:56 +01:00
Claude 43768781c8 Fix valgrind uninitialized memory errors
Fixed multiple uninitialized memory issues detected by valgrind:

1. SHA256 struct size mismatch: Changed from 64 bytes to 32 bytes to
   match the actual output of sha256() function (which produces 256
   bits = 32 bytes).

2. File tree chunk allocation: Fixed loop that wasn't initializing
   newly allocated chunks because num_chunks was updated before the
   initialization loop. Now saves old_num_chunks first.

3. Metadata server process_client_write: Initialized results[i].num_addrs
   to 0 before use to prevent reading uninitialized value.

4. Address struct initialization: Zero-initialize Address structs before
   setting fields to ensure the entire union is initialized (union
   contains either IPv4 or IPv6, leaving unused bytes uninitialized).

5. Fixed bug in IPv6 address creation: Changed incorrect is_ipv4=true
   to is_ipv4=false for IPv6 addresses.

6. Fixed all_chunk_servers_holding_chunk: Function was incrementing
   counter for all chunk servers instead of only those containing the
   hash, causing access to uninitialized array elements.

All valgrind errors resolved: ERROR SUMMARY: 0 errors from 0 contexts
2025-11-08 16:26:12 +00:00
cozis e5039d1774 Progress 2025-11-08 17:15:04 +01:00
cozis 7f3aa901f1 Progress 2025-11-08 13:25:17 +01:00
cozis 7846607651 Progress 2025-11-08 11:51:24 +01:00
cozis 279777fc8b Progress 2025-11-08 02:43:41 +01:00
cozis 463b1b4ba9 Progress 2025-11-08 02:16:46 +01:00
cozis 66eb81c9b9 Progress 2025-11-07 23:57:12 +01:00
cozis be2479b2be Progress 2025-11-07 22:45:40 +01:00
cozis 8ab426770f Progress 2025-11-07 22:18:05 +01:00
cozis d7cf946431 Progress 2025-11-07 20:26:15 +01:00
cozis 44fb1c4f36 Progress 2025-11-07 00:30:28 +01:00
cozis 407afffeb5 Progress 2025-11-06 21:39:22 +01:00
cozis 896bc0a23b Progress 2025-11-06 13:15:05 +01:00
cozis 0e27528d1d Progress 2025-11-06 01:23:24 +01:00
cozis e7455cc4ed Progress 2025-11-06 01:00:39 +01:00
cozis d192209c58 Progress 2025-11-05 23:14:24 +01:00
cozis 70a1914d8e Progress 2025-11-05 19:21:51 +01:00
cozis 18f1224c91 Progress 2025-11-05 17:09:38 +01:00
cozis e124952fe2 Progress 2025-11-05 14:26:57 +01:00
cozis 31a4b2cc32 Bug fixes 2025-11-03 18:32:14 +01:00
cozis e135d871c1 Progress 2025-11-03 15:52:25 +01:00