Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

[WIP] Set keepalive on Unix Socket #5458

Closed
wants to merge 2 commits into from
Closed

[WIP] Set keepalive on Unix Socket #5458

wants to merge 2 commits into from

Conversation

axic
Copy link
Member

@axic axic commented Jan 29, 2019

Fixes the connection closed issue from ethereum/solidity#3825

@axic axic requested review from gumb0 and chfast January 29, 2019 21:20
@@ -86,6 +86,15 @@ bool UnixDomainSocketServer::StartListening()
::bind(m_socket, reinterpret_cast<sockaddr*>(&m_address), sizeof(sockaddr_un));
fs::permissions(m_path, fs::owner_read | fs::owner_write);
listen(m_socket, 128);

int keepalive = 1;
if (setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive) < 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax error

Suggested change
if (setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive) < 0)
if (setsockopt(m_socket, SOL_SOCKET, SO_KEEPALIVE, &keepalive, sizeof(keepalive)) < 0)

@@ -141,7 +150,7 @@ size_t UnixDomainSocketServer::Write(int _connection, string const& _data)

size_t UnixDomainSocketServer::Read(int _connection, void* _data, size_t _size)
{
ssize_t r = read(_connection, _data, _size);
ssize_t r = recv(_connection, _data, _size, MSG_NOSIGNAL);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it do?

@axic
Copy link
Member Author

axic commented Jan 30, 2019

Hold on a sec, I have more fixes to this PR.

@chfast
Copy link
Member

chfast commented Feb 14, 2019

I'm newbie in context of socket programming. Is this still a problem?

Some time ago I tried to use the unix socket server from libjson-rpc-cpp #4565 but it didn't work at all. There is not a lot of changes there (https://github.com/cinemast/libjson-rpc-cpp/commits/master/src/jsonrpccpp/server/connectors/unixdomainsocketserver.cpp) but we can try again. Maybe they can setup it better than we are doing it currently.

@axic
Copy link
Member Author

axic commented Feb 14, 2019

It is, but this PR isn't finished. Please don't merge.

@axic axic changed the title Set keepalive on Unix Socket [WIP] Set keepalive on Unix Socket Feb 14, 2019
@axic
Copy link
Member Author

axic commented Sep 18, 2019

I will not have time to ever finish this PR and it is not an issue anymore in Solidity. The problem however persists if anyone wants to fix it.

@axic axic closed this Sep 18, 2019
@axic axic deleted the ipc-keepalive branch September 18, 2019 13:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants