Browse files

let the gethostbyname return in 15 seconds

when enable RSSWALL in performance, please wait ~15 seconds for exit the performance mode
  • Loading branch information...
1 parent 6be70cd commit fffa07631f7d694b799db8605639a2d51e9c9b10 Xiangfu Liu committed Jun 21, 2011
Showing with 13 additions and 3 deletions.
  1. +13 −1 src/main.c
  2. +0 −2 src/rsswall.c
View
14 src/main.c
@@ -22,6 +22,9 @@
#include <sys/stat.h>
#include <sys/types.h>
+#include <netinet/in.h>
+#include <resolv.h> /* those two head files for '_res.retry' */
+
#include <mtklib.h>
#include <rtems.h>
#include <bsp/milkymist_usbinput.h>
@@ -148,10 +151,12 @@ static void start_memcard()
mount("/dev/memcard1", "/memcard", "dosfs", RTEMS_FILESYSTEM_READ_ONLY, "");
}
+extern struct __res_state _res;
+
rtems_task Init(rtems_task_argument argument)
{
rtems_status_code sc;
-
+
sc = rtems_shell_init(
"SHLL",
RTEMS_MINIMUM_STACK_SIZE * 8,
@@ -164,6 +169,13 @@ rtems_task Init(rtems_task_argument argument)
if(sc != RTEMS_SUCCESSFUL)
printf("Unable to start shell (error code %d)\n", sc);
+ /* FIXME:
+ * alarm() should work anyway in gethostbyname().(for TIMEOUT in libcurl)
+ * in the meantime we have a workaround,
+ * make sure the gethostbyname() finished in 15 seconds
+ */
+ _res.retry = 2;
+
/* FIXME: can this be moved into the initialization table? */
memcard_register();
View
2 src/rsswall.c
@@ -268,8 +268,6 @@ static char *feed_get_last(const char *url)
return NULL;
}
curl_easy_setopt(curl_handle, CURLOPT_URL, url);
- /* FIXME: libcurl timeouts do not work in RTEMS */
- // maybe needed? curl_easy_setopt(curl_handle, CURLOPT_NOSIGNAL, 1);
curl_easy_setopt(curl_handle, CURLOPT_CONNECTTIMEOUT, 10);
curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 15);
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, data_callback);

0 comments on commit fffa076

Please sign in to comment.