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
98
Issues
98
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
98347708
Commit
98347708
authored
Dec 21, 2013
by
louiz’
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
connect() returns a boolean
parent
2ecb637f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
7 deletions
+9
-7
src/network/socket_handler.cpp
src/network/socket_handler.cpp
+3
-2
src/network/socket_handler.hpp
src/network/socket_handler.hpp
+1
-1
src/xmpp/xmpp_component.cpp
src/xmpp/xmpp_component.cpp
+2
-2
src/xmpp/xmpp_component.hpp
src/xmpp/xmpp_component.hpp
+3
-2
No files found.
src/network/socket_handler.cpp
View file @
98347708
...
...
@@ -20,7 +20,7 @@ SocketHandler::SocketHandler():
throw
std
::
runtime_error
(
"Could not create socket"
);
}
void
SocketHandler
::
connect
(
const
std
::
string
&
address
,
const
std
::
string
&
port
)
bool
SocketHandler
::
connect
(
const
std
::
string
&
address
,
const
std
::
string
&
port
)
{
log_info
(
"Trying to connect to "
<<
address
<<
":"
<<
port
);
struct
addrinfo
hints
;
...
...
@@ -47,13 +47,14 @@ void SocketHandler::connect(const std::string& address, const std::string& port)
{
log_info
(
"Connection success."
);
this
->
on_connected
();
return
;
return
true
;
}
log_info
(
"Connection failed:"
);
perror
(
"connect"
);
}
log_error
(
"All connection attempts failed."
);
this
->
close
();
return
false
;
}
void
SocketHandler
::
set_poller
(
Poller
*
poller
)
...
...
src/network/socket_handler.hpp
View file @
98347708
...
...
@@ -21,7 +21,7 @@ public:
/**
* Connect to the remote server, and call on_connected() if this succeeds
*/
void
connect
(
const
std
::
string
&
address
,
const
std
::
string
&
port
);
bool
connect
(
const
std
::
string
&
address
,
const
std
::
string
&
port
);
/**
* Set the pointer to the given Poller, to communicate with it.
*/
...
...
src/xmpp/xmpp_component.cpp
View file @
98347708
...
...
@@ -46,9 +46,9 @@ XmppComponent::~XmppComponent()
{
}
void
XmppComponent
::
start
()
bool
XmppComponent
::
start
()
{
this
->
connect
(
"127.0.0.1"
,
"5347"
);
return
this
->
connect
(
"127.0.0.1"
,
"5347"
);
}
void
XmppComponent
::
send_stanza
(
const
Stanza
&
stanza
)
...
...
src/xmpp/xmpp_component.hpp
View file @
98347708
...
...
@@ -25,9 +25,10 @@ public:
void
parse_in_buffer
()
override
final
;
/**
* Connect to the XMPP server
* Connect to the XMPP server.
* Returns false if we failed to connect
*/
void
start
();
bool
start
();
/**
* Serialize the stanza and add it to the out_buf to be sent to the
* server.
...
...
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