Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
0c3af626
Commit
0c3af626
authored
May 15, 2016
by
octal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Client: failing to connect will now be detected
parent
76db321d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
+11
-9
src/client/client.cc
src/client/client.cc
+11
-9
No files found.
src/client/client.cc
View file @
0c3af626
...
@@ -165,20 +165,22 @@ Transport::onReady(const Io::FdSet& fds) {
...
@@ -165,20 +165,22 @@ Transport::onReady(const Io::FdSet& fds) {
}
}
}
}
}
}
else
if
(
entry
.
isWritable
())
{
else
{
auto
tag
=
entry
.
getTag
();
auto
tag
=
entry
.
getTag
();
auto
fd
=
tag
.
value
();
auto
fd
=
tag
.
value
();
auto
connIt
=
connections
.
find
(
fd
);
auto
connIt
=
connections
.
find
(
fd
);
if
(
connIt
!=
std
::
end
(
connections
))
{
if
(
connIt
!=
std
::
end
(
connections
))
{
auto
&
conn
=
connIt
->
second
;
auto
&
conn
=
connIt
->
second
;
conn
.
resolve
();
if
(
entry
.
isHangup
())
// We are connected, we can start reading data now
conn
.
reject
(
Error
::
system
(
"Could not connect"
));
io
()
->
modifyFd
(
conn
.
connection
->
fd
,
NotifyOn
::
Read
);
else
{
continue
;
conn
.
resolve
();
// We are connected, we can start reading data now
io
()
->
modifyFd
(
conn
.
connection
->
fd
,
NotifyOn
::
Read
);
}
}
else
{
throw
std
::
runtime_error
(
"Unknown fd"
);
}
}
throw
std
::
runtime_error
(
"Unknown fd"
);
}
}
}
}
}
}
...
@@ -292,7 +294,7 @@ Transport::handleConnectionQueue() {
...
@@ -292,7 +294,7 @@ Transport::handleConnectionQueue() {
int
res
=
::
connect
(
conn
->
fd
,
data
.
addr
,
data
.
addr_len
);
int
res
=
::
connect
(
conn
->
fd
,
data
.
addr
,
data
.
addr_len
);
if
(
res
==
-
1
)
{
if
(
res
==
-
1
)
{
if
(
errno
==
EINPROGRESS
)
{
if
(
errno
==
EINPROGRESS
)
{
io
()
->
registerFdOneShot
(
conn
->
fd
,
NotifyOn
::
Write
);
io
()
->
registerFdOneShot
(
conn
->
fd
,
NotifyOn
::
Write
|
NotifyOn
::
Hangup
|
NotifyOn
::
Shutdown
);
}
}
else
{
else
{
data
.
reject
(
Error
::
system
(
"Failed to connect"
));
data
.
reject
(
Error
::
system
(
"Failed to connect"
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment