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
B
batajelo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
14
Issues
14
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
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
louiz’
batajelo
Commits
082831e2
Commit
082831e2
authored
Apr 15, 2012
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[network] Make it possible to request an answer but have a different command name in the answer.
parent
0975d3e6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
src/network/command_handler.cpp
src/network/command_handler.cpp
+4
-4
src/network/command_handler.hpp
src/network/command_handler.hpp
+2
-2
No files found.
src/network/command_handler.cpp
View file @
082831e2
...
...
@@ -136,11 +136,11 @@ void CommandHandler::install_read_handler(void)
boost
::
asio
::
placeholders
::
bytes_transferred
));
}
void
CommandHandler
::
request_answer
(
Command
*
command
,
t_read_callback
on_answer
)
void
CommandHandler
::
request_answer
(
Command
*
command
,
t_read_callback
on_answer
,
std
::
string
name
)
{
// We may want to send a command that do not require an answer.
if
(
on_answer
)
this
->
install_callback_once
(
command
->
get_name
()
,
on_answer
);
if
(
name
.
size
()
==
0
)
name
=
command
->
get_name
();
this
->
install_callback_once
(
name
,
on_answer
);
this
->
send
(
command
);
}
...
...
src/network/command_handler.hpp
View file @
082831e2
...
...
@@ -49,7 +49,7 @@ public:
* Sends a command, and use install_callback_once to wait for the answer
* and call that callback to handle it.
*/
void
request_answer
(
Command
*
,
t_read_callback
on_answer
=
0
);
void
request_answer
(
Command
*
,
t_read_callback
on_answer
,
std
::
string
name
=
""
);
/**
* Install a new callback associated with a command. This callback will
* be called upon receiving that command.
...
...
@@ -120,7 +120,7 @@ private:
command_queue
commands_to_send
;
/**
* Tells us if we are waiting for an async_write to finish or not
e
.
* Tells us if we are waiting for an async_write to finish or not.
* This must be set to true when calling async_write(), to false
* in the write handler. It is used by check_commands_to_send.
*/
...
...
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