mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-31 13:00:49 +00:00
Remove old docs, rename docs_new to docs
It would be probably good idea to also remove tools/docgen.py and asciidoc.mk, but asciidoc.mk is still mentioned under `cloud/doc`, which may contain some useful info which we'll need at least to review before removing. PUBLISHED_FROM=faf454d4c52a2f07ea8ac084cf0bd11a0c9c9b3b
This commit is contained in:
1 parent
f443c64341
commit
23122b327c
182 files changed
+3592
-263
No files matched your search
@@ -0,0 +1,31 @@
|
||||
---
|
||||
title: "mg_set_timer()"
|
||||
decl_name: "mg_set_timer"
|
||||
symbol_kind: "func"
|
||||
signature: |
|
||||
double mg_set_timer(struct mg_connection *c, double timestamp);
|
||||
---
|
||||
|
||||
Schedule MG_EV_TIMER event to be delivered at `timestamp` time.
|
||||
`timestamp` is a UNIX time (a number of seconds since Epoch). It is
|
||||
`double` instead of `time_t` to allow for sub-second precision.
|
||||
Return the old timer value.
|
||||
|
||||
Example: set connect timeout to 1.5 seconds:
|
||||
|
||||
```
|
||||
c = mg_connect(&mgr, "cesanta.com", ev_handler);
|
||||
mg_set_timer(c, mg_time() + 1.5);
|
||||
...
|
||||
|
||||
void ev_handler(struct mg_connection *c, int ev, void *ev_data) {
|
||||
switch (ev) {
|
||||
case MG_EV_CONNECT:
|
||||
mg_set_timer(c, 0); // Clear connect timer
|
||||
break;
|
||||
case MG_EV_TIMER:
|
||||
log("Connect timeout");
|
||||
c->flags |= MG_F_CLOSE_IMMEDIATELY;
|
||||
break;
|
||||
```
|
||||
|
||||
Reference in new issue
Block a user