MEDIUM: stream-interface: provide a generic si_conn_send_cb callback
The connection send() callback is supposed to be generic for a
stream-interface, and consists in calling the lower layer snd_buf
function. Move this function to the stream interface and remove
the sock-raw and sock-ssl clones.
diff --git a/src/sock_raw.c b/src/sock_raw.c
index e21177c..5b20f2f 100644
--- a/src/sock_raw.c
+++ b/src/sock_raw.c
@@ -44,7 +44,6 @@
/* main event functions used to move data between sockets and buffers */
static void sock_raw_read(struct connection *conn);
-static void sock_raw_write(struct connection *conn);
static void sock_raw_read0(struct stream_interface *si);
@@ -593,38 +592,6 @@
/*
- * This function is called on a write event from a stream socket.
- */
-static void sock_raw_write(struct connection *conn)
-{
- struct stream_interface *si = container_of(conn, struct stream_interface, conn);
- struct buffer *b = si->ob;
-
-#ifdef DEBUG_FULL
- fprintf(stderr,"sock_raw_write : fd=%d, owner=%p\n", fd, fdtab[fd].owner);
-#endif
-
- if (conn->flags & CO_FL_ERROR)
- goto out_error;
-
- /* we might have been called just after an asynchronous shutw */
- if (b->flags & BF_SHUTW)
- return;
-
- if (conn_data_snd_buf(conn) < 0)
- goto out_error;
-
- /* OK all done */
- return;
-
- out_error:
- /* Write error on the connection, report the error and stop I/O */
-
- conn->flags |= CO_FL_ERROR;
- conn_data_stop_both(conn);
-}
-
-/*
* This function propagates a null read received on a connection. It updates
* the stream interface. If the stream interface has SI_FL_NOHALF, we also
* forward the close to the write side.
@@ -681,7 +648,7 @@
.chk_rcv = stream_int_chk_rcv_conn,
.chk_snd = stream_int_chk_snd_conn,
.read = sock_raw_read,
- .write = sock_raw_write,
+ .write = si_conn_send_cb,
.snd_buf = sock_raw_write_loop,
.close = NULL,
};