Skip to content

Wii: fix hang after connect and failure on large replies in net_read/… - #2

Closed
TeleTubby666 wants to merge 1 commit into
dborth:masterfrom
TeleTubby666:wii-net-heap-limit
Closed

TeleTubby666 wants to merge 1 commit into
dborth:masterfrom
TeleTubby666:wii-net-heap-limit

Conversation

@TeleTubby666

Copy link
Copy Markdown

…net_write

On the Wii, connecting to an SMB share hangs after the tree connect, and opening a directory with many entries fails (the share root works, a large subfolder does not). A packet capture shows the server side is fine.

  • smb2_net_read(): libsmb2 reads in a loop until the socket reports EAGAIN, but net_read() does not return EAGAIN when no data is waiting, so smb2_service() never returns. Only read when select() reports data, otherwise return EAGAIN.
  • smb2_net_read()/smb2_net_write(): libogc's net_read()/net_write() copy the whole buffer through a fixed 64 KB IOS heap. A large reply (a directory listing is up to ~64 KB) fails with IPC_ENOMEM and breaks the connection. Cap a single call to 8 KB; libsmb2 resumes partial reads and writes.

Only affects wii

…net_write

On the Wii, connecting to an SMB share hangs after the tree connect, and
opening a directory with many entries fails (the share root works, a large
subfolder does not). A packet capture shows the server side is fine.

 - smb2_net_read(): libsmb2 reads in a loop until the socket reports EAGAIN,
   but net_read() does not return EAGAIN when no data is waiting, so
   smb2_service() never returns. Only read when select() reports data,
   otherwise return EAGAIN.
 - smb2_net_read()/smb2_net_write(): libogc's net_read()/net_write() copy the
   whole buffer through a fixed 64 KB IOS heap. A large reply (a directory
   listing is up to ~64 KB) fails with IPC_ENOMEM and breaks the connection.
   Cap a single call to 8 KB; libsmb2 resumes partial reads and writes.

Only affects __wii__.
@dborth

dborth commented Oct 13, 2026

Copy link
Copy Markdown
Owner

I think this is fixing this at the wrong layer. libsmb2 shouldn't need to work around this. I've submitted a PR for libogc2 - extremscorner/libogc2#31

@dborth dborth closed this Oct 13, 2026
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.

2 participants