Skip to content

Very short client connections missed in Ethernet/Server.cpp [imported] #345

Closed
@cmaglie

Description

@cmaglie

This is Issue 345 moved from a Google Code project.
Added by 2010-09-07T12:58:50.000Z by dmel...@gmail.com.
Please review that bug for more context and additional comments, but update this bug.
Closed (Fixed).

Original labels: Type-Defect, Priority-Medium, Component-Core, Milestone-0020

Original description

"There's a bug in Ethernet/Server.cpp that causes very short client connections to be missed, which in turn leaves the connection state around and eventually preventing new connections from being established.

This is the patch:

--- Server.cpp# 2010-09-03 16:43:28.000000000 -0700
+++ Server.cpp 2010-09-07 00:50:54.000000000 -0700
@@ -55,7 +55,8 @@
for (int sock = 0; sock < MAX_SOCK_NUM; sock++) {
Client client(sock);
if (EthernetClass::_server_port[sock] == _port &&

  •  client.status() == SnSR::ESTABLISHED) {
    
  •    (client.status() == SnSR::ESTABLISHED ||
    
  •     client.status() == SnSR::CLOSE_WAIT)) {
    
    if (client.available()) {
    // XXX: don't always pick the lowest numbered socket.
    return client;

What happens is that if a client connects, sends a small amount of data, and disconnects all before Server::available() is called, then client.status() is left in CLOSE_WAIT and available() never returns the connection.

Also, I think a client that connects and disconnects without sending any data should also be recognized as a valid connection. After all, no data is also information. I'll look into a fix (in both accept() and available()), but that one is an incompatible change (such connections are currently ignored so existing programs may not be equipped to handle it), so I'm not sure it's a good idea to do now."

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1283847987

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions