mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-25 13:23:02 +08:00
removed restart function from platform. no longer trying to
restart if the X server connection was lost; since synergy is likely to be started by xdm or the user's xsession, it's better for synergy to simply terminate when the connection is lost. synergy will still restart due to other errors. also fixed numerous other minor bugs and cleaned some stuff up (like app error codes are now consistent and enumerated in Version.h, for lack of a better place). and boosted version and protocol numbers.
This commit is contained in:
@@ -115,8 +115,9 @@ CTCPSocket::connect(const CNetworkAddress& addr)
|
||||
addr.getAddressLength()) == CNetwork::Error) {
|
||||
// check for failure
|
||||
if (CNetwork::getsockerror() != CNetwork::kECONNECTING) {
|
||||
XSocketConnect e;
|
||||
CNetwork::setblocking(m_fd, true);
|
||||
throw XSocketConnect();
|
||||
throw e;
|
||||
}
|
||||
|
||||
// wait for connection or failure
|
||||
@@ -130,8 +131,12 @@ CTCPSocket::connect(const CNetworkAddress& addr)
|
||||
if ((pfds[0].revents & (CNetwork::kPOLLERR |
|
||||
CNetwork::kPOLLNVAL)) != 0) {
|
||||
// connection failed
|
||||
int error = 0;
|
||||
CNetwork::AddressLength size = sizeof(error);
|
||||
CNetwork::setblocking(m_fd, true);
|
||||
throw XSocketConnect();
|
||||
CNetwork::getsockopt(m_fd, SOL_SOCKET, SO_ERROR,
|
||||
reinterpret_cast<char*>(&error), &size);
|
||||
throw XSocketConnect(error);
|
||||
}
|
||||
if ((pfds[0].revents & CNetwork::kPOLLOUT) != 0) {
|
||||
int error;
|
||||
@@ -142,7 +147,7 @@ CTCPSocket::connect(const CNetworkAddress& addr)
|
||||
error != 0) {
|
||||
// connection failed
|
||||
CNetwork::setblocking(m_fd, true);
|
||||
throw XSocketConnect();
|
||||
throw XSocketConnect(error);
|
||||
}
|
||||
|
||||
// connected!
|
||||
|
||||
Reference in New Issue
Block a user