summaryrefslogtreecommitdiff
path: root/src/network/core/tcp_connect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/core/tcp_connect.cpp')
-rw-r--r--src/network/core/tcp_connect.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/network/core/tcp_connect.cpp b/src/network/core/tcp_connect.cpp
index dc7a23bb3..bb96e33f9 100644
--- a/src/network/core/tcp_connect.cpp
+++ b/src/network/core/tcp_connect.cpp
@@ -33,6 +33,26 @@ TCPConnecter::TCPConnecter(const std::string &connection_string, uint16 default_
_tcp_connecters.push_back(this);
}
+/**
+ * Create a new connecter for the server.
+ * @param connection_string The address to connect to.
+ * @param default_port If not indicated in connection_string, what port to use.
+ */
+TCPServerConnecter::TCPServerConnecter(const std::string &connection_string, uint16 default_port) :
+ server_address(ServerAddress::Parse(connection_string, default_port))
+{
+ switch (this->server_address.type) {
+ case SERVER_ADDRESS_DIRECT:
+ this->connection_string = this->server_address.connection_string;
+ break;
+
+ default:
+ NOT_REACHED();
+ }
+
+ _tcp_connecters.push_back(this);
+}
+
TCPConnecter::~TCPConnecter()
{
if (this->resolve_thread.joinable()) {