Repository navigation
Conversation
|
I don't believe this memory copy is required to begin with, certainly not from/to MEM2. I'll have to check for MEM1. |
|
Thanks for picking this up. I reported the original issue in
I haven't tested this PR build on hardware yet. Since dborth/libsmb2#2 was |
|
Quick update: I tested a build with this PR (libogc2 PR 31) and an unmodified For reference, dborth/libsmb2#2 is closed, but it contains the I don't have a debug log from the hang yet. If it would help, I can build |
|
Update with hardware results: I tested this PR (libogc2 PR 31) with an net_read(len=4) calling -> = 4 So all PDUs of the connect are received correctly, and then the extra read What worked for me (dborth/libsmb2#2): call net_select() with a zero timeout |
IOS copies the whole payload of net_send()/net_recv() through the 64 KB net heap, so a single call with a large buffer fails with IPC_ENOMEM and callers such as libsmb2 (directory listings, large SMB2 replies) lose the connection. - net_sendto(): when there is no explicit destination, send in blocks of at most NET_MAX_TRANSFER (half the heap, so a concurrent user can still allocate). A short send, or an error after some blocks were already accepted, returns the byte count so far instead of the error, so the caller never resends data that IOS already has. Datagrams with an explicit destination are never split. - net_recvfrom(): with no source address, limit a single call to NET_MAX_TRANSFER and return the short read. Do not loop for more: that would block a blocking socket waiting for data that may never come, and on a non-blocking socket a later EAGAIN would discard data already read. - Parenthesize NET_HEAP_SIZE. Based on devkitPro/libogc#178 by DacoTaco, reworked for the mspace-based net heap and to fix the partial-transfer cases above. Co-authored-by: DacoTaco <daco_65@hotmail.com>
|
f0a7627 fixed this, I'm closing this PR. I helped @TeleTubby666 to track this remaining problem down. that one was a libsmb2 issue - it was pulling in the wrong header so FIONBIO was wrong - so depending on the build the socket wasn't non-blocking. submitted upstream to sahlberg/libsmb2#495 |
|
Technically I wasn't done with this, but I suppose the outcome is the same. That header doesn't come from the toolchain, but rather from libwiisocket, which I would've preferred you to use. |
|
Some data from real Wii hardware that may be relevant for deciding on this PR. I originally reported the "can't list a large directory" problem (dborth/libsmb2#2), and I attributed it to the 64 KB net heap. It turned out that the main cause was different: libsmb2's FIONBIO value did not match libogc2's net_ioctl(), so the socket stayed blocking. That is fixed now in sahlberg/libsmb2#495. With that fix, I retested using libogc2 master as of Oct 19 (f8f62e1, without this PR) and the same share. The directory that previously failed ("Nintendo - Super Nintendo Entertainment System/", it produced a 65424-byte read request in an earlier trace) now opens without problems. So for my use case this PR does not seem to be needed any more. I cannot say if there are other cases (very large replies or writes) that still need the transfer split. The trace for this run does not show the read sizes, so it is not a proof. Not tested: GameCube and plain libogc. |
a PR was recently submitted to me - dborth/libsmb2#2
the problem - net_recvfrom and net_sendto are neither bound nor gracefully handle large sizes.
looks like others have hit this before so I pulled the working fix from dacotaco (devkitPro/libogc@f4dbfca)