- Timestamp:
- 2010-03-21T15:56:59Z (15 years ago)
- Branches:
- master
- Children:
- 767a148
- Parents:
- 4ed9c8c
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/jabber/s5bytestream.c
r4ed9c8c ra81d679 46 46 47 47 gint connect_timeout; 48 49 char peek_buf[64]; 50 int peek_buf_len; 48 51 }; 49 52 … … 150 153 int fd = bt->tf->fd; 151 154 152 ASSERTSOCKOP( ret = recv( fd, buffer, buflen, MSG_PEEK ), "MSG_PEEK'ing" ); 155 if( buflen > sizeof( bt->peek_buf ) ) 156 return jabber_bs_abort( bt, "BUG: %d > sizeof(peek_buf)", buflen ); 157 158 ASSERTSOCKOP( ret = recv( fd, bt->peek_buf + bt->peek_buf_len, 159 buflen - bt->peek_buf_len, 0 ), "recv() on SOCKS5 connection" ); 153 160 154 161 if( ret == 0 ) 155 162 return jabber_bs_abort( bt, "Remote end closed connection" ); 156 157 if( ret < buflen ) 158 return ret; 159 160 ASSERTSOCKOP( ret = recv( fd, buffer, buflen, 0 ), "Dequeuing after MSG_PEEK" ); 161 162 if( ret != buflen ) 163 return jabber_bs_abort( bt, "recv returned less than previous recv with MSG_PEEK" ); 164 165 return ret; 163 164 bt->peek_buf_len += ret; 165 memcpy( buffer, bt->peek_buf, bt->peek_buf_len ); 166 167 if( bt->peek_buf_len == buflen ) 168 { 169 /* If we have everything the caller wanted, reset the peek buffer. */ 170 bt->peek_buf_len = 0; 171 return buflen; 172 } 173 else 174 return bt->peek_buf_len; 166 175 } 167 176 … … 560 569 561 570 bt->tf->watch_in = 0; 571 /* MUST always return FALSE! */ 562 572 return FALSE; 563 573 } … … 1012 1022 imcb_file_canceled( tf->ft, error ); 1013 1023 1024 /* MUST always return FALSE! */ 1014 1025 return FALSE; 1015 1026 }
Note: See TracChangeset
for help on using the changeset viewer.