-rw-r--r-- | kmicromail/libetpan/include/libetpan/mailstream.h | 1 | ||||
-rw-r--r-- | kmicromail/libetpan/tools/mailstream.c | 2 | ||||
-rw-r--r-- | kmicromail/libetpan/tools/mailstream.h | 3 | ||||
-rw-r--r-- | kmicromail/libetpan/tools/mailstream_socket.c | 13 |
4 files changed, 14 insertions, 5 deletions
diff --git a/kmicromail/libetpan/include/libetpan/mailstream.h b/kmicromail/libetpan/include/libetpan/mailstream.h index a4e35cd..ffb5062 100644 --- a/kmicromail/libetpan/include/libetpan/mailstream.h +++ b/kmicromail/libetpan/include/libetpan/mailstream.h | |||
@@ -36,2 +36,3 @@ | |||
36 | #ifndef MAILSTREAM_H | 36 | #ifndef MAILSTREAM_H |
37 | #define DEFAULT_NETWORK_TIMEOUT 30 | ||
37 | 38 | ||
diff --git a/kmicromail/libetpan/tools/mailstream.c b/kmicromail/libetpan/tools/mailstream.c index 0f55e67..6d1a8cc 100644 --- a/kmicromail/libetpan/tools/mailstream.c +++ b/kmicromail/libetpan/tools/mailstream.c | |||
@@ -42,3 +42,3 @@ | |||
42 | 42 | ||
43 | #define DEFAULT_NETWORK_TIMEOUT 300 | 43 | |
44 | 44 | ||
diff --git a/kmicromail/libetpan/tools/mailstream.h b/kmicromail/libetpan/tools/mailstream.h index a4e35cd..8a89a72 100644 --- a/kmicromail/libetpan/tools/mailstream.h +++ b/kmicromail/libetpan/tools/mailstream.h | |||
@@ -38,3 +38,4 @@ | |||
38 | #define MAILSTREAM_H | 38 | #define MAILSTREAM_H |
39 | 39 | //dont forget to change the value in <libetpan/mailstream.h> as well | |
40 | #define DEFAULT_NETWORK_TIMEOUT 30 | ||
40 | #include <sys/time.h> | 41 | #include <sys/time.h> |
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 | |||
@@ -171,4 +171,7 @@ static ssize_t mailstream_low_socket_read(mailstream_low * s, | |||
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; |
@@ -182,3 +185,3 @@ static ssize_t mailstream_low_socket_read(mailstream_low * s, | |||
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, |
@@ -202,4 +205,8 @@ static ssize_t mailstream_low_socket_write(mailstream_low * s, | |||
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; |