Skip to content

Commit acb843f

Browse files
committed
add comments
Added documentation comments in the new exported options Signed-off-by: R4R3D1FF <[email protected]>
1 parent ab7fdf8 commit acb843f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

option.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,30 @@ func WithInterceptors(interceptors ...Interceptor) Option {
352352
return &interceptorsOption{interceptors}
353353
}
354354

355+
// WithReadTimeout option specifies the maximum amount of time that a service
356+
// handler is allowed to take when reading a message in a stream.
357+
// If the total time exceeds WithReadTimeout, then that particular stream is
358+
// closed.
359+
// This enables the user to close only that particular stream instead of the
360+
// entire connection.
361+
// This prevents malicious or slow clients from using up resources.
362+
// This option is passed to the handler config and then to the spec.
363+
// Finally, ServeHTTP function of the handler reads the timeout values from
364+
// the spec and enforces them using ResponseController.
355365
func WithReadTimeout(value time.Duration) HandlerOption {
356366
return &readTimeoutOption{value: value}
357367
}
358368

369+
// WithWriteTimeout option specifies the maximum amount of time that a service
370+
// handler is allowed to take when writing a message to a stream.
371+
// If the total time exceeds WithReadTimeout, then that particular stream is
372+
// closed.
373+
// This enables the user to close only that particular stream instead of the
374+
// entire connection.
375+
// This prevents malicious or slow clients from using up resources.
376+
// This option is passed to the handler config and then to the spec.
377+
// Finally, ServeHTTP function of the handler reads the timeout values from
378+
// the spec and enforces them using ResponseController.
359379
func WithWriteTimeout(value time.Duration) HandlerOption {
360380
return &writeTimeoutOption{value: value}
361381
}

0 commit comments

Comments
 (0)