MEDIUM: xref/lua: Use xref for referencing cosocket relation between stream and lua

This relation will ensure that each was informed about death of another one.
diff --git a/include/types/applet.h b/include/types/applet.h
index e81cff7..347c71a 100644
--- a/include/types/applet.h
+++ b/include/types/applet.h
@@ -29,6 +29,7 @@
 #include <common/buffer.h>
 #include <common/chunk.h>
 #include <common/config.h>
+#include <common/xref.h>
 
 struct appctx;
 
@@ -73,7 +74,7 @@
 		} peers;                        /* used by the peers applet */
 		struct {
 			int connected;
-			struct hlua_socket *socket;
+			struct xref xref; /* cross reference with the Lua object owner. */
 			struct list wake_on_read;
 			struct list wake_on_write;
 			int die;
diff --git a/include/types/hlua.h b/include/types/hlua.h
index 214651f..a0a1e26 100644
--- a/include/types/hlua.h
+++ b/include/types/hlua.h
@@ -6,6 +6,8 @@
 #include <lua.h>
 #include <lauxlib.h>
 
+#include <common/xref.h>
+
 #include <types/proxy.h>
 #include <types/server.h>
 
@@ -159,7 +161,7 @@
  * SSL I/O. It uses a fake stream.
  */
 struct hlua_socket {
-	struct stream *s; /* Stream used for socket I/O. */
+	struct xref xref; /* cross reference with the stream used for socket I/O. */
 	luaL_Buffer b; /* buffer used to prepare strings. */
 };