changeset 18670:d54dc360cd3c

director: Minor code cleanup - allow access to auth connection's ostream directly.
author Timo Sirainen <tss@iki.fi>
date Wed, 13 May 2015 13:57:24 +0300
parents 67fdd6f962f5
children 5614bc437643
files src/director/auth-connection.c src/director/auth-connection.h src/director/login-connection.c
diffstat 3 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/auth-connection.c	Wed May 13 13:15:57 2015 +0300
+++ b/src/director/auth-connection.c	Wed May 13 13:57:24 2015 +0300
@@ -121,12 +121,10 @@
 	conn->callback(NULL, conn->context);
 }
 
-void auth_connection_send(struct auth_connection *conn,
-			  const void *data, size_t size)
+struct ostream *auth_connection_get_output(struct auth_connection *conn)
 {
-	i_assert(conn->fd != -1);
-
-	o_stream_nsend(conn->output, data, size);
+	i_assert(conn->output != NULL);
+	return conn->output;
 }
 
 void auth_connections_deinit(void)
--- a/src/director/auth-connection.h	Wed May 13 13:15:57 2015 +0300
+++ b/src/director/auth-connection.h	Wed May 13 13:57:24 2015 +0300
@@ -13,9 +13,8 @@
 
 /* Start connecting. Returns 0 if ok, -1 if connect failed. */
 int auth_connection_connect(struct auth_connection *conn);
-/* Send data to auth connection. */
-void auth_connection_send(struct auth_connection *conn,
-			  const void *data, size_t size);
+/* Get auth connection's output stream. */
+struct ostream *auth_connection_get_output(struct auth_connection *conn);
 
 void auth_connections_deinit(void);
 
--- a/src/director/login-connection.c	Wed May 13 13:15:57 2015 +0300
+++ b/src/director/login-connection.c	Wed May 13 13:57:24 2015 +0300
@@ -44,6 +44,7 @@
 
 static void login_connection_input(struct login_connection *conn)
 {
+	struct ostream *output;
 	unsigned char buf[4096];
 	ssize_t ret;
 
@@ -58,7 +59,8 @@
 		login_connection_deinit(&conn);
 		return;
 	}
-	auth_connection_send(conn->auth, buf, ret);
+	output = auth_connection_get_output(conn->auth);
+	o_stream_nsend(output, buf, ret);
 }
 
 static void