author | zautrix <zautrix> | 2004-09-02 08:57:01 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-02 08:57:01 (UTC) |
commit | 95e13360d1ef2a7caae121ae526a8a3c1ac12005 (patch) (unidiff) | |
tree | c9ca8e5c98a11eb5dd7d2afdc8e69d64cdffad25 /kmicromail | |
parent | f255826bda2f95721aec4d6c9ba372d852fb9d0b (diff) | |
download | kdepimpi-95e13360d1ef2a7caae121ae526a8a3c1ac12005.zip kdepimpi-95e13360d1ef2a7caae121ae526a8a3c1ac12005.tar.gz kdepimpi-95e13360d1ef2a7caae121ae526a8a3c1ac12005.tar.bz2 |
Added debug putput for program hang when reading pop3 mail data
-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 | |||
@@ -31,12 +31,13 @@ | |||
31 | 31 | ||
32 | /* | 32 | /* |
33 | * $Id$ | 33 | * $Id$ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #ifndef MAILSTREAM_H | 36 | #ifndef MAILSTREAM_H |
37 | #define DEFAULT_NETWORK_TIMEOUT 30 | ||
37 | 38 | ||
38 | #define MAILSTREAM_H | 39 | #define MAILSTREAM_H |
39 | 40 | ||
40 | #include <sys/time.h> | 41 | #include <sys/time.h> |
41 | 42 | ||
42 | #include <libetpan/mailstream_low.h> | 43 | #include <libetpan/mailstream_low.h> |
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 | |||
@@ -37,13 +37,13 @@ | |||
37 | #include "maillock.h" | 37 | #include "maillock.h" |
38 | #include <string.h> | 38 | #include <string.h> |
39 | #include <stdlib.h> | 39 | #include <stdlib.h> |
40 | #include <sys/types.h> | 40 | #include <sys/types.h> |
41 | #include <sys/stat.h> | 41 | #include <sys/stat.h> |
42 | 42 | ||
43 | #define DEFAULT_NETWORK_TIMEOUT 300 | 43 | |
44 | 44 | ||
45 | #ifdef LIBETPAN_MAILSTREAM_DEBUG | 45 | #ifdef LIBETPAN_MAILSTREAM_DEBUG |
46 | 46 | ||
47 | #define STREAM_DEBUG | 47 | #define STREAM_DEBUG |
48 | 48 | ||
49 | #include <stdio.h> | 49 | #include <stdio.h> |
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 | |||
@@ -33,13 +33,14 @@ | |||
33 | * $Id$ | 33 | * $Id$ |
34 | */ | 34 | */ |
35 | 35 | ||
36 | #ifndef MAILSTREAM_H | 36 | #ifndef MAILSTREAM_H |
37 | 37 | ||
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> |
41 | 42 | ||
42 | #include <libetpan/mailstream_low.h> | 43 | #include <libetpan/mailstream_low.h> |
43 | #include <libetpan/mailstream_helper.h> | 44 | #include <libetpan/mailstream_helper.h> |
44 | #include <libetpan/mailstream_socket.h> | 45 | #include <libetpan/mailstream_socket.h> |
45 | #include <libetpan/mailstream_ssl.h> | 46 | #include <libetpan/mailstream_ssl.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 | |||
@@ -166,24 +166,27 @@ static ssize_t mailstream_low_socket_read(mailstream_low * s, | |||
166 | timeout = mailstream_network_delay; | 166 | timeout = mailstream_network_delay; |
167 | 167 | ||
168 | FD_ZERO(&fds_read); | 168 | FD_ZERO(&fds_read); |
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; |
177 | if (!FD_ISSET(socket_data->fd, &fds_read)) | 180 | if (!FD_ISSET(socket_data->fd, &fds_read)) |
178 | return 0; | 181 | return 0; |
179 | } | 182 | } |
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 | { |
187 | struct mailstream_socket_data * socket_data; | 190 | struct mailstream_socket_data * socket_data; |
188 | 191 | ||
189 | socket_data = (struct mailstream_socket_data *) s->data; | 192 | socket_data = (struct mailstream_socket_data *) s->data; |
@@ -197,14 +200,18 @@ static ssize_t mailstream_low_socket_write(mailstream_low * s, | |||
197 | timeout = mailstream_network_delay; | 200 | timeout = mailstream_network_delay; |
198 | 201 | ||
199 | FD_ZERO(&fds_write); | 202 | FD_ZERO(&fds_write); |
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; |
208 | if (!FD_ISSET(socket_data->fd, &fds_write)) | 215 | if (!FD_ISSET(socket_data->fd, &fds_write)) |
209 | return 0; | 216 | return 0; |
210 | } | 217 | } |