Merge branch 'silc.1.1.branch' of silc repo
[runtime.git] / lib / silcutil / unix / silcunixnet.c
index 15720dcd53691f8903f6141776aaf7ac636fbb7f..c216ccca1f04f1f1f2ed86d812480e6f12402ca0 100644 (file)
@@ -4,7 +4,7 @@
 
   Author: Pekka Riikonen <priikone@silcnet.org>
 
-  Copyright (C) 1997 - 2007 Pekka Riikonen
+  Copyright (C) 1997 - 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
   GNU General Public License for more details.
 
 */
-/* $Id$ */
 
-#include "silc.h"
-#include "silcnet.h"
+#include "silcruntime.h"
 
 /************************** Types and definitions ***************************/
 
@@ -524,7 +522,8 @@ int silc_net_udp_receive(SilcStream stream, char *remote_ip_addr,
   SilcSocketStream sock = stream;
   SilcSockaddr s;
   struct sockaddr *from;
-  int len, flen;
+  int len;
+  unsigned int flen;
 
   SILC_LOG_DEBUG(("Reading data from UDP socket %d", sock->sock));
 
@@ -856,6 +855,9 @@ SILC_FSM_STATE(silc_net_connect_st_finish)
       silc_async_free(conn->op);
   }
 
+  if (conn->sock && conn->status != SILC_NET_OK)
+    silc_net_close_connection(conn->sock);
+
   return SILC_FSM_FINISH;
 }