Skip to content

Commit d11002c

Browse files
authored
add more clarity to the handlers docs (#80)
1 parent 69a12da commit d11002c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Following options are supported:
2828
* PingHandler - called when no message was sent during idle time. It should be safe for concurrent use.
2929
* InboundMessageHandler - called when a message from the server is received or no matching request for the message was found. InboundMessageHandler must be safe to be called concurrenty.
3030
* ReadTimeoutHandler - called when no messages have been received during specified ReadTimeout wait time. It should be safe for concurrent use.
31-
* ConnectionClosedHandler - is called when connection is closed by server or there were errors during network read/write that led to connection closure
31+
* ConnectionClosedHandler - is called when connection is closed by us, by server or there were errors during network read/write that led to connection closure
3232
* ErrorHandler - is called with the error when connection fails to perform some operation. In some cases instance of a `SafeError` will be passed to prevent data leaks ([detalis](https://github.com/moov-io/iso8583/pull/185))
3333

3434
If you want to override default options, you can do this when creating instance of a client or setting it separately using `SetOptions(options...)` method.
@@ -98,9 +98,9 @@ This section explains the various stages at which different handler functions ar
9898

9999
#### On connection closure:
100100

101-
- **`ConnectionClosedHandlers (async)`**: These asynchronous handlers are invoked when a connection is closed, either by the server or due to a connection error.
101+
- **`ConnectionClosedHandlers (async)`**: These asynchronous handlers are invoked after connection is closed by us, by the server or due to the network errors
102102

103-
- **`OnClose`** or **`OnCloseCtx`**: This handler is activated when we manually close the connection. **NOTE** If both `OnClose` and `OnCloseCtx` are defined, `OnCloseCtx` will be used.
103+
- **`OnClose`** or **`OnCloseCtx`**: This handler is activated before the connection is closed when we manually close the connection. **NOTE** If both `OnClose` and `OnCloseCtx` are defined, `OnCloseCtx` will be used.
104104

105105

106106
### (m)TLS connection

options.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ type Options struct {
4747
// * to handle network management messages (echo, heartbeat, etc.)
4848
InboundMessageHandler func(c *Connection, message *iso8583.Message)
4949

50-
// ConnectionClosedHandlers is called when connection is closed by server or there
51-
// were network errors during network read/write
50+
// ConnectionClosedHandlers is called after connection is closed by us,
51+
// by the server or when there are network errors during network
52+
// read/write
5253
ConnectionClosedHandlers []func(c *Connection)
5354

5455
// ConnectionEstablishedHandler is called when connection is

0 commit comments

Comments
 (0)