Author: bdonlan
Date: 2004-12-30 22:00:15 -0500 (Thu, 30 Dec 2004)
New Revision: 484
Modified:
trunk/
trunk/clients/ncurses/main.c
Log:
[EMAIL PROTECTED]: bdonlan | 2004-12-31T02:57:57.471314Z
Add 30-second delay before connect
Property changes on: trunk
___________________________________________________________________
Name: svk:merge
- 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:10234
27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212
edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238
+ 1f59643a-e6e5-0310-bc24-f7d4c744f460:/haver/local/trunk:10236
27e50396-46e3-0310-8b22-ae223a1f35ce:/local:212
edfcd8bd-4ce7-0310-a97e-bb1efd40edf3:/local:238
Modified: trunk/clients/ncurses/main.c
===================================================================
--- trunk/clients/ncurses/main.c 2004-12-31 02:12:54 UTC (rev 483)
+++ trunk/clients/ncurses/main.c 2004-12-31 03:00:15 UTC (rev 484)
@@ -16,6 +16,7 @@
void finish(int);
void handle_input(int fd, int mode, void *baton);
void heartbeat(const struct timeval *when, void *baton);
+void heartbeat_start(int delay);
lineio_conn *conn = NULL;
@@ -47,12 +48,11 @@
event_init();
display_init(LINES - 2);
- heartbeat(NULL, "Heartbeat 1");
+ heartbeat_start(30);
refresh();
event_addfd(0, EVENT_FD_READABLE | EVENT_FD_ERROR, handle_input, NULL);
- net_async_connect(connected_cb, NULL, "localhost", 12564);
for (;;) {
int c = event_poll(1);
@@ -146,9 +146,18 @@
};
}
+void heartbeat_start(int delay) {
+ struct timeval next = {delay, 0};
+ event_timer_rel(&next, heartbeat, NULL);
+}
+
void heartbeat(const struct timeval *when, void *baton) {
const char *message = baton;
struct timeval next;
+ if (!message) {
+ net_async_connect(connected_cb, NULL, "localhost", 12564);
+ baton = message = "Heartbeat 1";
+ }
display_print("%s\n", message);
next.tv_sec = 1;
next.tv_usec = 0;