[PATCH] osmo-trx[master]: Remove UDDSocket class

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Thu Jan 11 19:19:02 UTC 2018


Review at  https://gerrit.osmocom.org/5764

Remove UDDSocket class

This class is not used anymore in osmo-trx, so we can safely remove it.

Change-Id: I67f90aa3d6a2a5e92292436d10928e0705c8f8ff
---
M CommonLibs/Sockets.cpp
M CommonLibs/Sockets.h
M tests/CommonLibs/SocketsTest.cpp
3 files changed, 1 insertion(+), 95 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/64/5764/1

diff --git a/CommonLibs/Sockets.cpp b/CommonLibs/Sockets.cpp
index 11e96dd..ce8e3d5 100644
--- a/CommonLibs/Sockets.cpp
+++ b/CommonLibs/Sockets.cpp
@@ -284,51 +284,4 @@
 	return ntohs(name.sin_port);
 }
 
-
-
-
-
-UDDSocket::UDDSocket(const char* localPath, const char* remotePath)
-	:DatagramSocket()
-{
-	if (localPath!=NULL) open(localPath);
-	if (remotePath!=NULL) destination(remotePath);
-}
-
-
-
-void UDDSocket::open(const char* localPath)
-{
-	// create
-	mSocketFD = socket(AF_UNIX,SOCK_DGRAM,0);
-	if (mSocketFD<0) {
-		perror("socket() failed");
-		throw SocketError();
-	}
-
-	// bind
-	struct sockaddr_un address;
-	size_t length = sizeof(address);
-	bzero(&address,length);
-	address.sun_family = AF_UNIX;
-	strcpy(address.sun_path,localPath);
-	unlink(localPath);
-	if (bind(mSocketFD,(struct sockaddr*)&address,length)<0) {
-		perror("bind() failed");
-		throw SocketError();
-	}
-}
-
-
-
-void UDDSocket::destination(const char* remotePath)
-{
-	struct sockaddr_un* unAddr = (struct sockaddr_un*)mDestination;
-	unAddr->sun_family = AF_UNIX;
-	strcpy(unAddr->sun_path,remotePath);
-}
-
-
-
-
 // vim:ts=4:sw=4
diff --git a/CommonLibs/Sockets.h b/CommonLibs/Sockets.h
index 8312843..71b8b22 100644
--- a/CommonLibs/Sockets.h
+++ b/CommonLibs/Sockets.h
@@ -166,26 +166,6 @@
 
 };
 
-
-/** Unix Domain Datagram Socket */
-class UDDSocket : public DatagramSocket {
-
-public:
-
-	UDDSocket(const char* localPath=NULL, const char* remotePath=NULL);
-
-	void destination(const char* remotePath);
-
-	void open(const char* localPath);
-
-	/** Give the return address of the most recently received packet. */
-	const struct sockaddr_un* source() const { return (const struct sockaddr_un*)mSource; }
-
-	size_t addressSize() const { return sizeof(struct sockaddr_un); }
-
-};
-
-
 #endif
 
 
diff --git a/tests/CommonLibs/SocketsTest.cpp b/tests/CommonLibs/SocketsTest.cpp
index b51587d..235b8f3 100644
--- a/tests/CommonLibs/SocketsTest.cpp
+++ b/tests/CommonLibs/SocketsTest.cpp
@@ -53,38 +53,13 @@
 	return NULL;
 }
 
-
-
-void *testReaderUnix(void *)
-{
-	UDDSocket readSocket("testDestination");
-	readSocket.nonblocking();
-	int rc = 0;
-	while (rc<gNumToSend) {
-		char buf[MAX_UDP_LENGTH+1];
-		buf[MAX_UDP_LENGTH] =  '\0';
-		int count = readSocket.read(buf, MAX_UDP_LENGTH);
-		if (count>0) {
-			CERR("read: " << buf);
-			rc++;
-		} else {
-			sleep(2);
-		}
-	}
-	return NULL;
-}
-
-
 int main(int argc, char * argv[] )
 {
 
   Thread readerThreadIP;
   readerThreadIP.start(testReaderIP,NULL);
-  Thread readerThreadUnix;
-  readerThreadUnix.start(testReaderUnix,NULL);
 
   UDPSocket socket1("127.0.0.1", 5061, "127.0.0.1", 5934);
-  UDDSocket socket1U("testSource","testDestination");
 
   CERR("socket1: " << socket1.port());
 
@@ -93,12 +68,10 @@
 
   for (int i=0; i<gNumToSend; i++) {
     socket1.write("Hello IP land");
-	socket1U.write("Hello Unix domain");
-	sleep(1);
+    sleep(1);
   }
 
   readerThreadIP.join();
-  readerThreadUnix.join();
 
   printf("Done\n");
 }

-- 
To view, visit https://gerrit.osmocom.org/5764
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I67f90aa3d6a2a5e92292436d10928e0705c8f8ff
Gerrit-PatchSet: 1
Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>



More information about the gerrit-log mailing list