]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Connection API fixes
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Jun 2017 15:43:05 +0000 (11:43 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 15 Jun 2017 15:44:17 +0000 (11:44 -0400)
src/include/connection.h
src/main/connection.c

index aeebe256d0c47037121dafcaa776c5e3844d3c91..a85cddbbcfa96fb57705d10a3fe548a79edf83e3 100644 (file)
@@ -77,11 +77,12 @@ typedef fr_connection_state_t (*fr_connection_open_t)(int fd, fr_event_list_t *e
 typedef void (*fr_connection_close_t)(int fd, void *uctx);
 
 
-fr_connection_t const  *fr_connection_alloc(TALLOC_CTX *ctx, fr_event_list_t *el,
+fr_connection_t                *fr_connection_alloc(TALLOC_CTX *ctx, fr_event_list_t *el,
                                             struct timeval *open_time, struct timeval *wait_time,
                                             fr_connection_init_t init, fr_connection_open_t open,
                                             fr_connection_close_t close,
                                             char const *log_prefix,
                                             void *uctx);
+void                   fr_connection_start(fr_connection_t *conn);
 int                    fr_connection_get_fd(fr_connection_t const *conn);
 void                   fr_connection_reconnect(fr_connection_t *conn);
index faa44ffbf7302b183f5e29f732363f0d39fa5248..5d44894f8eaae3137c9e82074328fc5fb18374fb 100644 (file)
@@ -322,13 +322,13 @@ static int _connection_free(fr_connection_t *conn)
  *     - A new #fr_connection_t on success.
  *     - NULL on failure.
  */
-fr_connection_t const  *fr_connection_alloc(TALLOC_CTX *ctx, fr_event_list_t *el,
-                                            struct timeval *connection_timeout, struct timeval *reconnection_delay,
-                                            fr_connection_init_t init, fr_connection_open_t open, fr_connection_close_t close,
-                                            char const *log_prefix,
-                                            void *uctx)
+fr_connection_t *fr_connection_alloc(TALLOC_CTX *ctx, fr_event_list_t *el,
+                                    struct timeval *connection_timeout, struct timeval *reconnection_delay,
+                                    fr_connection_init_t init, fr_connection_open_t open, fr_connection_close_t close,
+                                    char const *log_prefix,
+                                    void *uctx)
 {
-       struct timeval now;
+
        fr_connection_t *conn;
 
        rad_assert(el);
@@ -349,11 +349,16 @@ fr_connection_t const     *fr_connection_alloc(TALLOC_CTX *ctx, fr_event_list_t *el,
        conn->log_prefix = talloc_typed_strdup(conn, log_prefix);
        conn->uctx = uctx;
 
+       return conn;
+}
+
+void fr_connection_start(fr_connection_t *conn)
+{
+       struct timeval now;
+
        gettimeofday(&now, NULL);
 
        connection_state_init(conn, &now);
-
-       return conn;
 }
 
 /** Asynchronously signal the connection should be reconnected