Changeset 3364 for pjproject/trunk


Ignore:
Timestamp:
Nov 12, 2010 7:42:58 AM (14 years ago)
Author:
nanang
Message:

Fix #1157: Fixed Symbian SSL socket to re-align the write (circular) buffer only when all pending write requests are completed, i.e: inside the write completion callback and when the buffer is empty.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjlib/src/pj/ssl_sock_symbian.cpp

    r3117 r3364  
    10211021            return; 
    10221022        } 
     1023    } else { 
     1024        /* Buffer empty, reset the start position */ 
     1025        st->start = st->buf; 
    10231026    } 
    10241027} 
     
    10591062     */ 
    10601063     
    1061     pj_size_t avail_len = st->max_len - st->len; 
    10621064    pj_size_t needed_len = *size + sizeof(write_data_t) - 1; 
    10631065     
     
    10651067    needed_len = ((needed_len + 3) >> 2) << 2;  
    10661068 
    1067     /* Block until there is buffer slot available! */ 
    1068     while (needed_len >= avail_len) { 
     1069    /* Block until there is buffer slot available and contiguous! */ 
     1070    while (st->start + st->len + needed_len > st->buf + st->max_len) { 
    10691071        pj_symbianos_poll(-1, -1); 
    1070         avail_len = st->max_len - st->len; 
    1071     } 
    1072  
    1073     /* Ok, make sure the new data will not get wrapped */ 
    1074     if (st->start + st->len + needed_len > st->buf + st->max_len) { 
    1075         /* Align buffer left */ 
    1076         pj_memmove(st->buf, st->start, st->len); 
    1077         st->start = st->buf; 
    1078     } 
    1079      
     1072    } 
     1073 
    10801074    /* Push back the send data into the buffer */ 
    10811075    write_data_t *wdata = (write_data_t*)(st->start + st->len); 
Note: See TracChangeset for help on using the changeset viewer.