Changeset 699

Show
Ignore:
Timestamp:
02/11/08 07:44:26 (10 months ago)
Author:
dormando
Message:

Break out of the read-loop when read returns with available space
(trond.norbye@sun.com)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/memcached.c

    r698 r699  
    19191919        } 
    19201920 
    1921         res = read(c->sfd, c->rbuf + c->rbytes, c->rsize - c->rbytes); 
     1921        int avail = c->rsize - c->rbytes; 
     1922        res = read(c->sfd, c->rbuf + c->rbytes, avail); 
    19221923        if (res > 0) { 
    19231924            STATS_LOCK(); 
     
    19261927            gotdata = 1; 
    19271928            c->rbytes += res; 
    1928             continue; 
     1929            if (res == avail) { 
     1930                continue; 
     1931            } else { 
     1932                break; 
     1933            } 
    19291934        } 
    19301935        if (res == 0) {