Use erlang:demonitor(Ref, [flush]) where applicable
Fix watchdog table leak

A service process maintains a table keyed on watchdog process pids. When
a watchdog process dies the corresponding entry should be removed but
this was broken in commit f115a9f7, causing entries with watchdog state
DOWN to accumulate.

Watchdog processes die as a result of diameter:remove_transport/2, or
when a peer reestablishes a connection in the listening case. Neither is
typically a frequent occurrence.

The fault manifests itself in the return value of
diameter:service_info(SvcName, transport), which displays entries for
watchdog processes that are no longer alive.
Optimize communication with file io server

The file module communicates with a file io server with the following
protocol for file operations:

> {file_request,From,ReplyAs,Request}
< {file_reply,ReplyAs,Reply}

The ReplyAs value is sent by the client side to match against when
receiving the reply and is otherwise left untouched and passed as is by
the server.

This commit enables receive optimizations by using the reference of the
server monitor, changing the protocol to:

> {file_request,From,MonitorRef,Request}
< {file_reply,MonitorRef,Reply}

As the shape of the messages is not changed, backwards compatibility is
not a concern.
Add transport interface 'connected' message with local address list

A transport module can return a local address list from its start/3
function in order to specify addresses to be used as Host-IP-Address
during capabilities exchange. Now allow addresses to be communicated in
a 'connected' message in the case of a connecting transport, so that
diameter_tcp (in particular) can make local address configuration
optional, communicating the gen_tcp default after connection
establishment instead.
Make explicit local address to diameter_tcp:start/3 optional

Use the default address address (as selected by gen_tcp) if none is
configured, passing it in the new 'connected' message introduced by the
previous commit.

The corresponding update to diameter_sctp has to wait until problems
with inet:sockname/1 are resolved: the function currently only returns
one address, and sometimes {0,0,0,0}. See OTP-11018.
Update example client to allow default local address

Note that the semantics of client:connect/1 have changed slightly: the
second element in an argument 3-tuple is a remote address, the local
address being the transport module's default. Previously it was
interpreted as a common local/remote address.
More robust listening port lookup in test suites

In particular, remove timing dependence by using diameter_reg:wait/1 to
wait on the term registered by diameter_{tcp,sctp} when opening a
listening socket.
Comment fix
Add testcase to exercise reconnect behaviour
Minor doc fix
Merge branch 'anders/diameter/address_config/OTP-10986' into maint

* anders/diameter/address_config/OTP-10986:
  Comment fix
  More robust listening port lookup in test suites
  Update example client to allow default local address
  Make explicit local address to diameter_tcp:start/3 optional
  Add transport interface 'connected' message with local address list
Merge branch 'anders/diameter/watchdog_leak/OTP-11019' into maint

* anders/diameter/watchdog_leak/OTP-11019:
  Minor doc fix
  Add testcase to exercise reconnect behaviour
  Fix watchdog table leak
Merge branch 'maint'
Merge branch 'nox/file-receive-optim/OTP-11040' into maint

* nox/file-receive-optim/OTP-11040:
  Optimize communication with file io server
Merge branch 'maint'
Merge branch 'lh/demonitor-flush/OTP-11039' into maint

* lh/demonitor-flush/OTP-11039:
  Use erlang:demonitor(Ref, [flush]) where applicable
Merge branch 'maint'