Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 9094c0f in mainline


Ignore:
Timestamp:
2012-05-11T10:33:01Z (9 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
01a7aa1
Parents:
d786dea9
Message:

Fix recv[from]() with small user buffer.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/srv/net/tcp/sock.c

    rd786dea9 r9094c0f  
    728728        rc = async_data_read_finalize(rcallid, socket->recv_buffer, length);
    729729
    730         socket->recv_buffer_used = 0;
     730        socket->recv_buffer_used -= length;
     731        log_msg(LVL_DEBUG, "tcp_sock_recvfrom: %zu left in buffer",
     732            socket->recv_buffer_used);
     733        if (socket->recv_buffer_used > 0) {
     734                memmove(socket->recv_buffer, socket->recv_buffer + length,
     735                    socket->recv_buffer_used);
     736                tcp_sock_notify_data(socket->sock_core);
     737        }
     738
    731739        fibril_condvar_broadcast(&socket->recv_buffer_cv);
    732740
Note: See TracChangeset for help on using the changeset viewer.