diff src/network/core/tcp_connect.cpp @ 17148:848eb1ffb17d draft

(svn r21886) -Codechange: move documentation towards the code to make it more likely to be updated [n].
author rubidium <rubidium@openttd.org>
date Sat, 22 Jan 2011 09:53:15 +0000
parents afdfdda87cd4
children
line wrap: on
line diff
--- a/src/network/core/tcp_connect.cpp
+++ b/src/network/core/tcp_connect.cpp
@@ -21,6 +21,10 @@
 /** List of connections that are currently being created */
 static SmallVector<TCPConnecter *,  1> _tcp_connecters;
 
+/**
+ * Create a new connecter for the given address
+ * @param address the (un)resolved address to connect to
+ */
 TCPConnecter::TCPConnecter(const NetworkAddress &address) :
 	connected(false),
 	aborted(false),
@@ -34,6 +38,7 @@
 	}
 }
 
+/** The actual connection function */
 void TCPConnecter::Connect()
 {
 	this->sock = this->address.Connect();
@@ -44,12 +49,21 @@
 	}
 }
 
-
+/**
+ * Entry point for the new threads.
+ * @param param the TCPConnecter instance to call Connect on.
+ */
 /* static */ void TCPConnecter::ThreadEntry(void *param)
 {
 	static_cast<TCPConnecter*>(param)->Connect();
 }
 
+/**
+ * Check whether we need to call the callback, i.e. whether we
+ * have connected or aborted and call the appropriate callback
+ * for that. It's done this way to ease on the locking that
+ * would otherwise be needed everywhere.
+ */
 /* static */ void TCPConnecter::CheckCallbacks()
 {
 	for (TCPConnecter **iter = _tcp_connecters.Begin(); iter < _tcp_connecters.End(); /* nothing */) {
@@ -76,6 +90,7 @@
 	}
 }
 
+/** Kill all connection attempts. */
 /* static */ void TCPConnecter::KillAll()
 {
 	for (TCPConnecter **iter = _tcp_connecters.Begin(); iter != _tcp_connecters.End(); iter++) (*iter)->killed = true;