aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-09-26 10:43:12 +0200
committerLoïc Hoguin <[email protected]>2019-09-26 10:53:00 +0200
commitd86d55c1f90b37d991e20ad0f1ac37b1e38b36e1 (patch)
tree23a34ec9158d6abfddc6142923535304c02662c1 /doc
parentd9a970be90d0105af215531d74809878f9c21338 (diff)
downloadgun-d86d55c1f90b37d991e20ad0f1ac37b1e38b36e1.tar.gz
gun-d86d55c1f90b37d991e20ad0f1ac37b1e38b36e1.tar.bz2
gun-d86d55c1f90b37d991e20ad0f1ac37b1e38b36e1.zip
Add a function to change the connection owner
While at it the gun:info/1 function has been fixed to work even when we are in the not_connected state, and the owner is now also returned.
Diffstat (limited to 'doc')
-rw-r--r--doc/src/manual/gun.asciidoc1
-rw-r--r--doc/src/manual/gun.info.asciidoc2
-rw-r--r--doc/src/manual/gun.set_owner.asciidoc57
3 files changed, 60 insertions, 0 deletions
diff --git a/doc/src/manual/gun.asciidoc b/doc/src/manual/gun.asciidoc
index 478d40b..9670e2e 100644
--- a/doc/src/manual/gun.asciidoc
+++ b/doc/src/manual/gun.asciidoc
@@ -16,6 +16,7 @@ Connection:
* link:man:gun:open(3)[gun:open(3)] - Open a connection to the given host and port
* link:man:gun:open_unix(3)[gun:open_unix(3)] - Open a connection to the given Unix domain socket
+* link:man:gun:set_owner(3)[gun:set_owner(3)] - Set a new owner for the connection
* link:man:gun:shutdown(3)[gun:shutdown(3)] - Gracefully close the connection
* link:man:gun:close(3)[gun:close(3)] - Brutally close the connection
* link:man:gun:info(3)[gun:info(3)] - Obtain information about the connection
diff --git a/doc/src/manual/gun.info.asciidoc b/doc/src/manual/gun.info.asciidoc
index cf861c9..edd97f6 100644
--- a/doc/src/manual/gun.info.asciidoc
+++ b/doc/src/manual/gun.info.asciidoc
@@ -12,6 +12,7 @@ info(ConnPid) -> Info
ConnPid :: pid()
Info :: #{
+ owner => pid(),
socket => inet:socket() | ssl:sslsocket(),
transport => tcp | tls,
protocol => http | http2 | socks | ws,
@@ -45,6 +46,7 @@ the connection.
== Changelog
+* *2.0*: The value `owner` was added.
* *1.3*: The values `socket`, `transport`, `protocol`, `origin_host`,
`origin_port` and `intermediaries` were added.
* *1.0*: Function introduced.
diff --git a/doc/src/manual/gun.set_owner.asciidoc b/doc/src/manual/gun.set_owner.asciidoc
new file mode 100644
index 0000000..ee12a67
--- /dev/null
+++ b/doc/src/manual/gun.set_owner.asciidoc
@@ -0,0 +1,57 @@
+= gun:set_owner(3)
+
+== Name
+
+gun:set_owner - Set a new owner for the connection
+
+== Description
+
+[source,erlang]
+----
+set_owner(ConnPid, OwnerPid) -> ok
+
+ConnPid :: pid()
+OwnerPid :: pid()
+----
+
+Set a new owner for the connection.
+
+Only the current owner of the connection can set a new
+owner.
+
+Gun monitors the owner of the connection and automatically
+shuts down gracefully when the owner exits.
+
+== Arguments
+
+ConnPid::
+
+The pid of the Gun connection process.
+
+OwnerPid::
+
+The pid of the new owner for the connection.
+
+== Return value
+
+The atom `ok` is returned.
+
+== Changelog
+
+* *2.0*: Function introduced.
+
+== Examples
+
+.Set a new owner for the connection
+[source,erlang]
+----
+ok = gun:set_owner(ConnPid, OwnerPid).
+----
+
+== See also
+
+link:man:gun(3)[gun(3)],
+link:man:gun:open(3)[gun:open(3)],
+link:man:gun:open_unix(3)[gun:open_unix(3)],
+link:man:gun:shutdown(3)[gun:shutdown(3)],
+link:man:gun:close(3)[gun:close(3)]