Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
biboumi
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
99
Issues
99
List
Boards
Labels
Service Desk
Milestones
Merge Requests
12
Merge Requests
12
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
louiz’
biboumi
Commits
d834d6ed
Commit
d834d6ed
authored
Nov 03, 2013
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Exit the poller when it handles no connection at all
parent
f2f94618
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
4 deletions
+10
-4
src/irc/irc_client.cpp
src/irc/irc_client.cpp
+0
-1
src/network/poller.cpp
src/network/poller.cpp
+4
-1
src/network/poller.hpp
src/network/poller.hpp
+2
-1
src/network/socket_handler.cpp
src/network/socket_handler.cpp
+4
-1
No files found.
src/irc/irc_client.cpp
View file @
d834d6ed
...
...
@@ -21,7 +21,6 @@ void IrcClient::on_connected()
void
IrcClient
::
on_connection_close
()
{
std
::
cout
<<
"Connection closed by remote server."
<<
std
::
endl
;
this
->
close
();
}
void
IrcClient
::
parse_in_buffer
()
...
...
src/network/poller.cpp
View file @
d834d6ed
...
...
@@ -89,9 +89,11 @@ void Poller::stop_watching_send_events(const SocketHandler* const socket_handler
throw
std
::
runtime_error
(
"Cannot watch a non-registered socket for send events"
);
}
void
Poller
::
poll
()
bool
Poller
::
poll
()
{
#if POLLER == POLL
if
(
this
->
nfds
==
0
)
return
false
;
int
res
=
::
poll
(
this
->
fds
,
this
->
nfds
,
-
1
);
if
(
res
<
0
)
{
...
...
@@ -119,4 +121,5 @@ void Poller::poll()
}
}
#endif
return
true
;
}
src/network/poller.hpp
View file @
d834d6ed
...
...
@@ -57,8 +57,9 @@ public:
/**
* Wait for all watched events, and call the SocketHandlers' callbacks
* when one is ready.
* Returns false if there are 0 SocketHandler in the list.
*/
void
poll
();
bool
poll
();
private:
/**
...
...
src/network/socket_handler.cpp
View file @
d834d6ed
...
...
@@ -66,7 +66,10 @@ void SocketHandler::on_recv()
ssize_t
size
=
::
recv
(
this
->
socket
,
buf
,
4096
,
0
);
if
(
0
==
size
)
this
->
on_connection_close
();
{
this
->
on_connection_close
();
this
->
close
();
}
else
if
(
-
1
==
static_cast
<
ssize_t
>
(
size
))
throw
std
::
runtime_error
(
"Error reading from socket"
);
else
...
...
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