Fossil SCM
On windows, a recv() call fails if the return value is less than or equal to zero. Ticket [66cbcd56a229f33af6b9a6329a7]
Commit
c12e5b102ee6079715da0fa4eff7fb502b68b111
Parent
72e9eb6a0d4c6e7…
1 file changed
+2
-2
+2
-2
| --- src/http.c | ||
| +++ src/http.c | ||
| @@ -152,20 +152,20 @@ | ||
| 152 | 152 | ** the number of bytes read into the blob. Any prior content |
| 153 | 153 | ** of the blob is discarded, not freed. |
| 154 | 154 | ** |
| 155 | 155 | ** The function was placed here in http.c due to it's socket |
| 156 | 156 | ** 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. | |
| 158 | 158 | */ |
| 159 | 159 | int socket_read_blob(Blob *pBlob, int pSockId, int nToRead){ |
| 160 | 160 | int i=0,read=0; |
| 161 | 161 | char rbuf[50]; |
| 162 | 162 | blob_zero(pBlob); |
| 163 | 163 | while ( i<nToRead ){ |
| 164 | 164 | read = recv(pSockId, rbuf, 50, 0); |
| 165 | 165 | i += read; |
| 166 | - if( read<0 ){ | |
| 166 | + if( read<=0 ){ | |
| 167 | 167 | return 0; |
| 168 | 168 | } |
| 169 | 169 | blob_append(pBlob, rbuf, read); |
| 170 | 170 | } |
| 171 | 171 | return blob_size(pBlob); |
| 172 | 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 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 |