-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbufferevent_settimeout.3
86 lines (86 loc) · 2.52 KB
/
bufferevent_settimeout.3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
.\" $OpenBSD$
.\" Copyright (c) 2023 Ted Bullock <tbullock@comlore.com>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate$
.Dt BUFFEREVENT_SETTIMEOUT 3
.Os
.Sh NAME
.Nm bufferevent_settimeout
.Nd configure bufferevent timeout
.Sh SYNOPSIS
.In event.h
.Ft void
.Fo bufferevent_settimeout
.Fa "struct bufferevent *bufev"
.Fa "int timeout_read"
.Fa "int timeout_write"
.Fc
.Sh DESCRIPTION
.Fn bufferevent_settimeout
sets or updates the read and write timeout durations for the
.Vt bufferevent
structure
.Fa bufev .
The arguments
.Fa timeout_read
and
.Fa timeout_write
are the number of seconds to configure each value to.
The function causes undefined behavior if
.Va bufev
is
.Dv NULL .
A timeout value of zero removes a timeout event for a
.Vt bufferevent
if it exists.
When a timeout expires, the error callback is triggered with the
.Dv EVBUFFER_TIMEOUT
flag enabled.
.Pp
If a program attempts to reuse the
.Vt bufferevent
data structure for a new file descriptor with
.Xr bufferevent_setfd 3 ,
any previously set timeouts still apply to the new file descriptor.
This is because the timeout settings are associated with the
.Vt bufferevent
structure, not the file descriptor itself.
.Pp
Negative timeout values cause undefined behavior.
.Sh SEE ALSO
.Xr bufferevent_enable 3 ,
.Xr bufferevent_new 3 ,
.Xr bufferevent_setfd 3
.Sh HISTORY
This function first appeared in libevent-0.8 and has been available since
.Ox 3.6 .
.Sh AUTHORS
This function was written by
.An -nosplit
.An Niels Provos .
.Pp
This manual page was written by
.An Ted Bullock Aq Mt tbullock@comlore.com .
.Sh CAVEATS
.Fn bufferevent_settimeout
has an API design limitation: it returns
.Ft void
and does not directly notify the caller when it fails.
On failure, the program terminates by calling
.Xr exit 3
with a status of 1.
.Pp
For more information on diagnosing failures, refer to
.Xr event_add 3 .