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
88
Issues
88
List
Boards
Labels
Service Desk
Milestones
Merge Requests
7
Merge Requests
7
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
e196d2f1
Commit
e196d2f1
authored
Mar 24, 2014
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not send data if we are connected, send it only once we actually are
parent
3b1bf740
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
17 additions
and
1 deletion
+17
-1
src/irc/irc_client.cpp
src/irc/irc_client.cpp
+1
-0
src/network/socket_handler.cpp
src/network/socket_handler.cpp
+8
-1
src/network/socket_handler.hpp
src/network/socket_handler.hpp
+4
-0
src/xmpp/xmpp_component.cpp
src/xmpp/xmpp_component.cpp
+4
-0
No files found.
src/irc/irc_client.cpp
View file @
e196d2f1
...
...
@@ -45,6 +45,7 @@ void IrcClient::on_connected()
this
->
send_nick_command
(
this
->
username
);
this
->
send_user_command
(
this
->
username
,
this
->
username
);
this
->
send_gateway_message
(
"Connected to IRC server."
);
this
->
send_pending_data
();
}
void
IrcClient
::
on_connection_close
()
...
...
src/network/socket_handler.cpp
View file @
e196d2f1
...
...
@@ -238,7 +238,14 @@ void SocketHandler::send_data(std::string&& data)
if
(
data
.
empty
())
return
;
this
->
out_buf
.
emplace_back
(
std
::
move
(
data
));
this
->
poller
->
watch_send_events
(
this
);
if
(
this
->
connected
)
this
->
poller
->
watch_send_events
(
this
);
}
void
SocketHandler
::
send_pending_data
()
{
if
(
this
->
connected
&&
!
this
->
out_buf
.
empty
())
this
->
poller
->
watch_send_events
(
this
);
}
bool
SocketHandler
::
is_connected
()
const
...
...
src/network/socket_handler.hpp
View file @
e196d2f1
...
...
@@ -51,6 +51,10 @@ public:
* notified when a send event is ready.
*/
void
send_data
(
std
::
string
&&
data
);
/**
* Watch the socket for send events, if our out buffer is not empty.
*/
void
send_pending_data
();
/**
* Returns the socket that should be handled by the poller.
*/
...
...
src/xmpp/xmpp_component.cpp
View file @
e196d2f1
...
...
@@ -82,6 +82,9 @@ void XmppComponent::on_connected()
node
[
"to"
]
=
this
->
served_hostname
;
this
->
send_stanza
(
node
);
this
->
doc_open
=
true
;
// We may have some pending data to send: this happens when we try to send
// some data before we are actually connected. We send that data right now, if any
this
->
send_pending_data
();
}
void
XmppComponent
::
on_connection_close
()
...
...
@@ -161,6 +164,7 @@ void XmppComponent::on_remote_stream_open(const XmlNode& node)
void
XmppComponent
::
on_remote_stream_close
(
const
XmlNode
&
node
)
{
log_debug
(
"XMPP DOCUMENT CLOSE "
<<
node
.
to_string
());
this
->
doc_open
=
false
;
}
void
XmppComponent
::
on_stanza
(
const
Stanza
&
stanza
)
...
...
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