Added socket stream and socket into SilcClientConnection context.
authorPekka Riikonen <priikone@silcnet.org>
Sat, 15 Mar 2008 18:24:27 +0000 (20:24 +0200)
committerPekka Riikonen <priikone@silcnet.org>
Sat, 15 Mar 2008 18:24:27 +0000 (20:24 +0200)
lib/silcclient/client_connect.c
lib/silcclient/client_listener.c
lib/silcclient/silcclient.h

index aeaa374fd231991dd57b6610d0856390d70ff264..9d74e0b317124323dd399e99428cf37db422248a 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2006 - 2007 Pekka Riikonen
+  Copyright (C) 2006 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -454,6 +454,11 @@ SILC_FSM_STATE(silc_client_st_connect_set_stream)
 
   silc_packet_set_context(conn->stream, conn);
 
+  /* Save socket stream and socket into connection context */
+  conn->socket_stream = silc_packet_stream_get_stream(conn->stream);
+  silc_socket_stream_get_info(conn->socket_stream, &conn->sock, NULL,
+                             NULL, NULL);
+
   /** Start key exchange */
   silc_fsm_next(fsm, silc_client_st_connect_key_exchange);
   return SILC_FSM_CONTINUE;
@@ -551,6 +556,9 @@ SILC_FSM_STATE(silc_client_st_connect_setup_udp)
   /* Set the new stream to packet stream */
   old = silc_packet_stream_get_stream(conn->stream);
   silc_packet_stream_set_stream(conn->stream, stream);
+  conn->socket_stream = stream;
+  silc_socket_stream_get_info(conn->socket_stream, &conn->sock, NULL,
+                             NULL, NULL);
   silc_packet_stream_set_iv_included(conn->stream);
   silc_packet_set_sid(conn->stream, 0);
 
index 3735877cc9368fbf42ae59e003bc52cbfb4f35dd..76db6af75a6d5cf5c5e39215a0b2a40000de8714 100644 (file)
@@ -181,6 +181,9 @@ silc_client_listener_new_connection(SilcClientListener listener,
     return;
   }
   conn->stream = stream;
+  conn->socket_stream = silc_packet_stream_get_stream(stream);
+  silc_socket_stream_get_info(conn->socket_stream, &conn->sock, NULL,
+                             NULL, NULL);
   conn->internal->schedule = listener->schedule;
   silc_packet_set_context(conn->stream, conn);
 
index 5e6c0d42f822bf861a193f5d64dbc9c342ae4e37..23f1aabcc863ab3988a3049d9f8942f17e2a902b 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 2000 - 2007 Pekka Riikonen
+  Copyright (C) 2000 - 2008 Pekka Riikonen
 
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -227,6 +227,8 @@ struct SilcClientConnectionStruct {
   SilcPublicKey public_key;           /* Public key used in this connection */
   SilcPrivateKey private_key;         /* Private key */
   SilcPacketStream stream;            /* Connection to remote host */
+  SilcStream socket_stream;           /* Socket stream from 'stream' */
+  SilcSocket sock;                    /* The socket from 'socket_stream' */
   SilcConnectionType type;            /* Connection type */
   SilcClientConnectCallback callback;  /* Connection callback */
   void *callback_context;             /* Connection context */