MEDIUM: stream_interface: pass connection instead of fd in sock_ops

The sock_ops I/O callbacks made use of an FD till now. This has become
inappropriate and the struct connection is much more useful. It also
fixes the race condition introduced by previous change.
diff --git a/src/sock_raw.c b/src/sock_raw.c
index 74ad127..cdb0e27 100644
--- a/src/sock_raw.c
+++ b/src/sock_raw.c
@@ -42,8 +42,8 @@
 #include <types/global.h>
 
 /* main event functions used to move data between sockets and buffers */
-static int sock_raw_read(int fd);
-static int sock_raw_write(int fd);
+static int sock_raw_read(struct connection *conn);
+static int sock_raw_write(struct connection *conn);
 static void sock_raw_data_finish(struct stream_interface *si);
 static void sock_raw_shutr(struct stream_interface *si);
 static void sock_raw_shutw(struct stream_interface *si);
@@ -226,9 +226,9 @@
  * able to read more data without polling first. Returns non-zero
  * otherwise.
  */
-static int sock_raw_read(int fd)
+static int sock_raw_read(struct connection *conn)
 {
-	struct connection *conn = fdtab[fd].owner;
+	int fd = conn->t.sock.fd;
 	struct stream_interface *si = container_of(conn, struct stream_interface, conn);
 	struct buffer *b = si->ib;
 	int ret, max, retval, cur_read;
@@ -240,9 +240,6 @@
 
 	retval = 1;
 
-	if (!conn)
-		goto out_wakeup;
-
 	/* stop immediately on errors. Note that we DON'T want to stop on
 	 * POLL_ERR, as the poller might report a write error while there
 	 * are still data available in the recv buffer. This typically
@@ -631,9 +628,9 @@
  * It returns 0 if the caller needs to poll before calling it again, otherwise
  * non-zero.
  */
-static int sock_raw_write(int fd)
+static int sock_raw_write(struct connection *conn)
 {
-	struct connection *conn = fdtab[fd].owner;
+	int fd = conn->t.sock.fd;
 	struct stream_interface *si = container_of(conn, struct stream_interface, conn);
 	struct buffer *b = si->ob;
 	int retval = 1;
@@ -642,10 +639,6 @@
 	fprintf(stderr,"sock_raw_write : fd=%d, owner=%p\n", fd, fdtab[fd].owner);
 #endif
 
-	retval = 1;
-	if (!conn)
-		goto out_wakeup;
-
 	if (conn->flags & CO_FL_ERROR)
 		goto out_error;