Abdellazizhammami / arduino

Automatically exported from code.google.com/p/arduino
Other
0 stars 0 forks source link

Possible bug in Ethernet library? #670

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In libraries/Ethernet/utility/socket.cpp, at line 154.

    // No data available.
    uint8_t status = W5100.readSnSR(s);
    if ( s == SnSR::LISTEN || s == SnSR::CLOSED || s == SnSR::CLOSE_WAIT )
    {
      // The remote end has closed its side of the connection, so this is the eof state
      ret = 0;
    } 

I'm guessing the intention was to actually test the socket's status byte?  It 
doesn't make much sense to compare status codes to the socket index (eg, 0 to 
3)?

Maybe it was meant to be like this?

    uint8_t status = W5100.readSnSR(s);
    if ( status == SnSR::LISTEN || status == SnSR::CLOSED || status == SnSR::CLOSE_WAIT )
    {  // ....

Hope this helps. 

Original issue reported on code.google.com by paul.sto...@gmail.com on 5 Oct 2011 at 10:35

GoogleCodeExporter commented 9 years ago
https://github.com/arduino/Arduino/commit/9296f1db314d172f96a25f7d804347b5c5eb3d
e7

BTW, Adrian, can you see if this looks okay?

Original comment by dmel...@gmail.com on 10 Oct 2011 at 3:51