Skip to content

Commit

Permalink
HPCC-32829 Remove redundant accept peerEp param
Browse files Browse the repository at this point in the history
Signed-off-by: Jake Smith <[email protected]>
  • Loading branch information
jakesmith committed Oct 18, 2024
1 parent 8becb08 commit 9725270
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion roxie/udplib/udpsha.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class CSocketSimulator : public CInterfaceOf<ISocket>
virtual size32_t writetms(void const* buf, size32_t minSize, size32_t size, unsigned timeoutms=WAIT_FOREVER) override { UNIMPLEMENTED; }

virtual size32_t get_max_send_size() override { UNIMPLEMENTED; }
virtual ISocket* accept(bool allowcancel=false, SocketEndpoint *peerEp = nullptr) override { UNIMPLEMENTED; }
virtual ISocket* accept(bool allowcancel=false) override { UNIMPLEMENTED; }
virtual int logPollError(unsigned revents, const char *rwstr) override { UNIMPLEMENTED; }
virtual int wait_read(unsigned timeout) override { UNIMPLEMENTED; }
virtual int wait_write(unsigned timeout) override { UNIMPLEMENTED; }
Expand Down
7 changes: 2 additions & 5 deletions system/jlib/jsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ class CSocket: public ISocket, public CInterface
void shutdown(unsigned mode=SHUTDOWN_READWRITE);
void shutdownNoThrow(unsigned mode);

ISocket* accept(bool allowcancel, SocketEndpoint *peerEp=nullptr);
ISocket* accept(bool allowcancel);
int wait_read(unsigned timeout);
int logPollError(unsigned revents, const char *rwstr);
int wait_write(unsigned timeout);
Expand Down Expand Up @@ -1254,7 +1254,7 @@ void CSocket::open(int listen_queue_size,bool reuseports)



ISocket* CSocket::accept(bool allowcancel, SocketEndpoint *_peerEp)
ISocket* CSocket::accept(bool allowcancel)
{
if ((accept_cancel_state!=accept_not_cancelled) && allowcancel) {
accept_cancel_state=accept_cancelled;
Expand Down Expand Up @@ -1336,9 +1336,6 @@ ISocket* CSocket::accept(bool allowcancel, SocketEndpoint *_peerEp)

SocketEndpoint peerEp;
getSockAddrEndpoint(peerSockAddr, peerSockAddrLen, peerEp);
if (_peerEp)
*_peerEp = peerEp;

CSocket *ret = new CSocket(newsock,sm_tcp,true,&peerEp);
ret->checkCfgKeepAlive();
ret->set_inherit(false);
Expand Down
2 changes: 1 addition & 1 deletion system/jlib/jsocket.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ class jlib_decl ISocket : extends IInterface
//
// This method is called by server to accept client connection
//
virtual ISocket* accept(bool allowcancel=false, SocketEndpoint *peerEp = nullptr) = 0; // not needed for UDP
virtual ISocket* accept(bool allowcancel=false) = 0; // not needed for UDP

//
// log poll() errors
Expand Down
16 changes: 8 additions & 8 deletions system/mp/mpcomm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -534,19 +534,20 @@ class CMPConnectThread: public Thread
{
CConnectSelectHandler &selectHandler;
Owned<ISocket> sock;
SocketEndpoint peerEP;
StringBuffer peerHostText, peerEndpointText;
ConnectHdr hdr;
cycle_t createTime = 0;
size32_t readSoFar = 0;
CriticalSection crit;
bool closedOrHandled = false;
public:
CSocketHandler(CConnectSelectHandler &_selectHandler, ISocket *_sock, const SocketEndpoint &_peerEP) : selectHandler(_selectHandler), sock(_sock), peerEP(_peerEP)
CSocketHandler(CConnectSelectHandler &_selectHandler, ISocket *_sock) : selectHandler(_selectHandler), sock(_sock)
{
createTime = get_cycles_now();
SocketEndpoint peerEP;
sock->getPeerEndpoint(peerEP);
peerEP.getHostText(peerHostText); // always used by handleAcceptedSocket
peerEndpointText.append(peerEndpointText); // only used if tracing an error
peerEndpointText.append(peerHostText); // only used if tracing an error
if (peerEP.port)
peerEndpointText.append(':').append(peerEP.port);
}
Expand Down Expand Up @@ -689,7 +690,7 @@ class CMPConnectThread: public Thread
maintenanceSem.signal();
maintenanceThread.join();
}
void add(ISocket *sock, const SocketEndpoint &peerEP)
void add(ISocket *sock)
{
while (true)
{
Expand All @@ -704,7 +705,7 @@ class CMPConnectThread: public Thread
MilliSleep(1000);
}

Owned<CSocketHandler> socketHandler = new CSocketHandler(*this, LINK(sock), peerEP);
Owned<CSocketHandler> socketHandler = new CSocketHandler(*this, LINK(sock));

size_t numHandlers;
{
Expand Down Expand Up @@ -2553,10 +2554,9 @@ int CMPConnectThread::run()
while (running)
{
Owned<ISocket> sock;
SocketEndpoint peerEP;
try
{
sock.setown(listensock->accept(true, &peerEP));
sock.setown(listensock->accept(true));
}
catch (IException *e)
{
Expand Down Expand Up @@ -2595,7 +2595,7 @@ int CMPConnectThread::run()
// After that, the socket will be removed from the connectSelectHamndler,
// a CMPChannel will be estalbished, and the socket will be added to the MP CMPPacketReader select handler.
// See handleAcceptedSocket.
connectSelectHandler.add(sock, peerEP);
connectSelectHandler.add(sock);
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion system/security/securesocket/securesocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ class CSecureSocket : implements ISecureSocket, public CInterface
//
// This method is called by server to accept client connection
//
virtual ISocket* accept(bool allowcancel=false, SocketEndpoint *peerEp=nullptr) // not needed for UDP
virtual ISocket* accept(bool allowcancel=false) // not needed for UDP
{
throw MakeStringException(-1, "CSecureSocket::accept: not implemented");
}
Expand Down

0 comments on commit 9725270

Please sign in to comment.