File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ namespace rcpp {
118
118
119
119
int AsyncSocketClient::write (const char * buf, int len, int timeoutms)
120
120
{
121
+ // int written_len = 0;
121
122
int written_len = write (buf, len);
122
123
if (written_len == len)
123
124
{
@@ -150,7 +151,7 @@ namespace rcpp {
150
151
int AsyncSocketClient::read (char * buf, int len, int timeoutms)
151
152
{
152
153
int readlen = read (buf, len);
153
- if (readlen > 0 )
154
+ if (readlen >= 0 )
154
155
{
155
156
return readlen;
156
157
}
@@ -167,7 +168,7 @@ namespace rcpp {
167
168
{
168
169
_err_code = ret;
169
170
printf (" read, select socket select timeout\n " );
170
- return 0 ;
171
+ return - 1 ;
171
172
}
172
173
if (FD_ISSET (_sockfd, &_rfds))
173
174
{
Original file line number Diff line number Diff line change @@ -265,11 +265,16 @@ std::shared_ptr<BaseValue> RClient::get_results(int& ret_code)
265
265
READ_DATA:
266
266
// int len = sockets::Read(_sockfd, (void*)_bufptr->write_ptr(), _bufptr->writable_size());
267
267
int len = _aclient->read (_bufptr->write_ptr (), _bufptr->writable_size (), _read_timeout);
268
- if (len < = 0 )
268
+ if (len = = 0 )
269
269
{
270
270
ret_code = TCP_CONNECTION_ERROR;
271
271
return nullptr ;
272
272
}
273
+ else if (len == -1 )
274
+ {
275
+ ret_code = TCP_TIMEOUT;
276
+ return nullptr ;
277
+ }
273
278
_bufptr->has_written (len);
274
279
char * text = _bufptr->read_ptr ();
275
280
size_t old_pos = _bufptr->get_read_off ();
You can’t perform that action at this time.
0 commit comments