Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mtxclient
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
mtxclient
Commits
9184845f
Commit
9184845f
authored
7 years ago
by
Konstantinos Sideris
Browse files
Options
Downloads
Patches
Plain Diff
Specify option for https port
parent
30cd8636
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
Makefile
+1
-1
1 addition, 1 deletion
Makefile
src/client.cpp
+3
-2
3 additions, 2 deletions
src/client.cpp
src/client.hpp
+3
-1
3 additions, 1 deletion
src/client.hpp
tests/connection.cpp
+22
-2
22 additions, 2 deletions
tests/connection.cpp
with
29 additions
and
6 deletions
Makefile
+
1
−
1
View file @
9184845f
...
...
@@ -20,7 +20,7 @@ synapse:
@
./.ci/adjust-config.sh
@
docker run
-d
\
--name
synapse
\
-p
443:8448
-p
8
0:8008
-p
3478:347
8
\
-p
443:8448
-p
8
448:844
8
\
-v
`
pwd
`
/data:/data
${
SYNAPSE_IMAGE
}
start
@
echo
Waiting
for
synapse to start...
@
sleep
5
...
...
This diff is collapsed.
Click to expand it.
src/client.cpp
+
3
−
2
View file @
9184845f
...
...
@@ -10,9 +10,10 @@
using
namespace
mtx
::
client
;
using
namespace
boost
::
beast
;
Client
::
Client
(
const
std
::
string
&
server
)
Client
::
Client
(
const
std
::
string
&
server
,
uint16_t
port
)
:
resolver_
{
ios_
}
,
server_
{
server
}
,
port_
{
port
}
{
work_
.
reset
(
new
boost
::
asio
::
io_service
::
work
(
ios_
));
...
...
@@ -139,7 +140,7 @@ void
Client
::
do_request
(
std
::
shared_ptr
<
Session
>
s
)
{
resolver_
.
async_resolve
(
server_
,
"443"
,
std
::
to_string
(
port_
)
,
std
::
bind
(
&
Client
::
on_resolve
,
shared_from_this
(),
s
,
...
...
This diff is collapsed.
Click to expand it.
src/client.hpp
+
3
−
1
View file @
9184845f
...
...
@@ -40,7 +40,7 @@ to_string(PaginationDirection dir)
class
Client
:
public
std
::
enable_shared_from_this
<
Client
>
{
public:
Client
(
const
std
::
string
&
server
=
""
);
Client
(
const
std
::
string
&
server
=
""
,
uint16_t
port
=
443
);
//! Wait for the client to close.
void
close
();
...
...
@@ -240,6 +240,8 @@ private:
mtx
::
identifiers
::
User
user_id_
;
//! The token that will be used as the 'since' parameter on the next sync request.
std
::
string
next_batch_token_
;
//! The homeserver port to connect.
uint16_t
port_
=
443
;
};
}
}
...
...
This diff is collapsed.
Click to expand it.
tests/connection.cpp
+
22
−
2
View file @
9184845f
...
...
@@ -2,10 +2,30 @@
#include
<iostream>
#include
"client.hpp"
#include
"errors.hpp"
#include
"mtx/responses.hpp"
using
namespace
mtx
::
client
;
TEST
(
Basic
,
Connection
)
{}
using
namespace
std
;
TEST
(
Basic
,
Failure
)
{}
using
ErrType
=
std
::
experimental
::
optional
<
errors
::
ClientError
>
;
TEST
(
Basic
,
Connection
)
{
auto
alice
=
std
::
make_shared
<
Client
>
(
"localhost"
,
8448
);
auto
bob
=
std
::
make_shared
<
Client
>
(
"localhost"
,
443
);
alice
->
versions
([](
const
mtx
::
responses
::
Versions
&
,
ErrType
err
)
{
ASSERT_FALSE
(
err
);
});
bob
->
versions
([](
const
mtx
::
responses
::
Versions
&
,
ErrType
err
)
{
ASSERT_FALSE
(
err
);
});
bob
->
close
();
alice
->
close
();
}
TEST
(
Basic
,
Failure
)
{
auto
alice
=
std
::
make_shared
<
Client
>
(
"not-resolvable-example-domain.wrong"
);
alice
->
versions
([](
const
mtx
::
responses
::
Versions
&
,
ErrType
err
)
{
ASSERT_TRUE
(
err
);
});
alice
->
close
();
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment