From: Adam Tkac Date: Mon, 21 Dec 2009 16:35:28 +0000 (+0000) Subject: [Cleanup] Remove unused Socket::getMyAddress and Socket::getMyEndpoint functions. X-Git-Tag: v1.0.90~366 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=763de175aff3bc3345558346a596fec0f2f7c5f0;p=tigervnc.git [Cleanup] Remove unused Socket::getMyAddress and Socket::getMyEndpoint functions. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@3930 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- diff --git a/common/network/Socket.h b/common/network/Socket.h index b93da2ef..378a9006 100644 --- a/common/network/Socket.h +++ b/common/network/Socket.h @@ -50,9 +50,7 @@ namespace network { bool isShutdown() const {return isShutdown_;} // information about this end of the socket - virtual char* getMyAddress() = 0; // a string e.g. "192.168.0.1" virtual int getMyPort() = 0; - virtual char* getMyEndpoint() = 0; //
:: // information about the remote end of the socket virtual char* getPeerAddress() = 0; // a string e.g. "192.168.0.1" diff --git a/common/network/TcpSocket.cxx b/common/network/TcpSocket.cxx index 93cdceb2..e2b61a83 100644 --- a/common/network/TcpSocket.cxx +++ b/common/network/TcpSocket.cxx @@ -228,36 +228,10 @@ TcpSocket::~TcpSocket() { closesocket(getFd()); } -char* TcpSocket::getMyAddress() { - struct sockaddr_in info; - struct in_addr addr; - socklen_t info_size = sizeof(info); - - getsockname(getFd(), (struct sockaddr *)&info, &info_size); - memcpy(&addr, &info.sin_addr, sizeof(addr)); - - char* name = inet_ntoa(addr); - if (name) { - return rfb::strDup(name); - } else { - return rfb::strDup(""); - } -} - int TcpSocket::getMyPort() { return getSockPort(getFd()); } -char* TcpSocket::getMyEndpoint() { - rfb::CharArray address; address.buf = getMyAddress(); - int port = getMyPort(); - - int buflen = strlen(address.buf) + 32; - char* buffer = new char[buflen]; - sprintf(buffer, "%s::%d", address.buf, port); - return buffer; -} - char* TcpSocket::getPeerAddress() { struct sockaddr_in info; struct in_addr addr; diff --git a/common/network/TcpSocket.h b/common/network/TcpSocket.h index 774c6e13..00ccf78a 100644 --- a/common/network/TcpSocket.h +++ b/common/network/TcpSocket.h @@ -46,9 +46,7 @@ namespace network { TcpSocket(const char *name, int port); virtual ~TcpSocket(); - virtual char* getMyAddress(); virtual int getMyPort(); - virtual char* getMyEndpoint(); virtual char* getPeerAddress(); virtual int getPeerPort();