Fossil SCM

On windows, a recv() call fails if the return value is less than or equal to zero. Ticket [66cbcd56a229f33af6b9a6329a7]

drh 2008-11-27 13:50 trunk
Commit c12e5b102ee6079715da0fa4eff7fb502b68b111
1 file changed +2 -2
+2 -2
--- src/http.c
+++ src/http.c
@@ -152,20 +152,20 @@
152152
** the number of bytes read into the blob. Any prior content
153153
** of the blob is discarded, not freed.
154154
**
155155
** The function was placed here in http.c due to it's socket
156156
** nature and we did not want to introduce socket headers into
157
-** the socket netural blob.c file.
157
+** the socket neutral blob.c file.
158158
*/
159159
int socket_read_blob(Blob *pBlob, int pSockId, int nToRead){
160160
int i=0,read=0;
161161
char rbuf[50];
162162
blob_zero(pBlob);
163163
while ( i<nToRead ){
164164
read = recv(pSockId, rbuf, 50, 0);
165165
i += read;
166
- if( read<0 ){
166
+ if( read<=0 ){
167167
return 0;
168168
}
169169
blob_append(pBlob, rbuf, read);
170170
}
171171
return blob_size(pBlob);
172172
--- src/http.c
+++ src/http.c
@@ -152,20 +152,20 @@
152 ** the number of bytes read into the blob. Any prior content
153 ** of the blob is discarded, not freed.
154 **
155 ** The function was placed here in http.c due to it's socket
156 ** nature and we did not want to introduce socket headers into
157 ** the socket netural blob.c file.
158 */
159 int socket_read_blob(Blob *pBlob, int pSockId, int nToRead){
160 int i=0,read=0;
161 char rbuf[50];
162 blob_zero(pBlob);
163 while ( i<nToRead ){
164 read = recv(pSockId, rbuf, 50, 0);
165 i += read;
166 if( read<0 ){
167 return 0;
168 }
169 blob_append(pBlob, rbuf, read);
170 }
171 return blob_size(pBlob);
172
--- src/http.c
+++ src/http.c
@@ -152,20 +152,20 @@
152 ** the number of bytes read into the blob. Any prior content
153 ** of the blob is discarded, not freed.
154 **
155 ** The function was placed here in http.c due to it's socket
156 ** nature and we did not want to introduce socket headers into
157 ** the socket neutral blob.c file.
158 */
159 int socket_read_blob(Blob *pBlob, int pSockId, int nToRead){
160 int i=0,read=0;
161 char rbuf[50];
162 blob_zero(pBlob);
163 while ( i<nToRead ){
164 read = recv(pSockId, rbuf, 50, 0);
165 i += read;
166 if( read<=0 ){
167 return 0;
168 }
169 blob_append(pBlob, rbuf, read);
170 }
171 return blob_size(pBlob);
172

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button