Diffstat (limited to 'kmicromail/libetpan/tools/mailstream_socket.c') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libetpan/tools/mailstream_socket.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/kmicromail/libetpan/tools/mailstream_socket.c b/kmicromail/libetpan/tools/mailstream_socket.c index 29e50e1..04a6f48 100644 --- a/kmicromail/libetpan/tools/mailstream_socket.c +++ b/kmicromail/libetpan/tools/mailstream_socket.c | |||
@@ -169,8 +169,11 @@ static ssize_t mailstream_low_socket_read(mailstream_low * s, | |||
169 | FD_SET(socket_data->fd, &fds_read); | 169 | FD_SET(socket_data->fd, &fds_read); |
170 | FD_ZERO(&fds_excp); | 170 | FD_ZERO(&fds_excp); |
171 | FD_SET(socket_data->fd, &fds_excp); | 171 | FD_SET(socket_data->fd, &fds_excp); |
172 | // LUTZ for safety I insert here a max val as well | ||
173 | if ( timeout.tv_sec > DEFAULT_NETWORK_TIMEOUT ) | ||
174 | timeout.tv_sec = DEFAULT_NETWORK_TIMEOUT; | ||
172 | r = select(socket_data->fd + 1, &fds_read, NULL, &fds_excp, &timeout); | 175 | r = select(socket_data->fd + 1, &fds_read, NULL, &fds_excp, &timeout); |
173 | if (r == 0) | 176 | if (r < 1 ) |
174 | return -1; | 177 | return -1; |
175 | if (FD_ISSET(socket_data->fd, &fds_excp)) | 178 | if (FD_ISSET(socket_data->fd, &fds_excp)) |
176 | return -1; | 179 | return -1; |
@@ -180,7 +183,7 @@ static ssize_t mailstream_low_socket_read(mailstream_low * s, | |||
180 | return recv(socket_data->fd,buf,count,MSG_NOSIGNAL); | 183 | return recv(socket_data->fd,buf,count,MSG_NOSIGNAL); |
181 | //return read(socket_data->fd, buf, count); | 184 | //return read(socket_data->fd, buf, count); |
182 | } | 185 | } |
183 | 186 | #include <stdio.h> | |
184 | static ssize_t mailstream_low_socket_write(mailstream_low * s, | 187 | static ssize_t mailstream_low_socket_write(mailstream_low * s, |
185 | const void * buf, size_t count) | 188 | const void * buf, size_t count) |
186 | { | 189 | { |
@@ -200,8 +203,12 @@ static ssize_t mailstream_low_socket_write(mailstream_low * s, | |||
200 | FD_SET(socket_data->fd, &fds_write); | 203 | FD_SET(socket_data->fd, &fds_write); |
201 | FD_ZERO(&fds_excp); | 204 | FD_ZERO(&fds_excp); |
202 | FD_SET(socket_data->fd, &fds_excp); | 205 | FD_SET(socket_data->fd, &fds_excp); |
206 | // LUTZ next line blocks sometimes | ||
207 | if ( timeout.tv_sec > DEFAULT_NETWORK_TIMEOUT ) | ||
208 | timeout.tv_sec = DEFAULT_NETWORK_TIMEOUT; | ||
209 | fprintf(stderr,"fd %d to secs %d \n", socket_data->fd, timeout.tv_sec ); | ||
203 | r = select(socket_data->fd + 1, NULL, &fds_write, &fds_excp, &timeout); | 210 | r = select(socket_data->fd + 1, NULL, &fds_write, &fds_excp, &timeout); |
204 | if (r == 0) | 211 | if (r < 1) |
205 | return -1; | 212 | return -1; |
206 | if (FD_ISSET(socket_data->fd, &fds_excp)) | 213 | if (FD_ISSET(socket_data->fd, &fds_excp)) |
207 | return -1; | 214 | return -1; |