Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mtproto_proxy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
mtproto_proxy
Commits
6bc13bec
Unverified
Commit
6bc13bec
authored
Jul 26, 2019
by
Sergey Prokhorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken tests (padding)
parent
ddc04d67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
mtp_full.erl
src/mtp_full.erl
+6
-2
No files found.
src/mtp_full.erl
View file @
6bc13bec
...
...
@@ -55,14 +55,18 @@ try_decode_packet(<<Len:32/little, PktSeqNo:32/signed-little, Tail/binary>>,
PacketCrc
=
erlang
:
crc32
([
<<
Len
:
32
/
little
,
PktSeqNo
:
32
/
little
>>
|
Body
]),
(
CRC
==
PacketCrc
)
orelse
error
({
wrong_checksum
,
CRC
,
PacketCrc
}),
%% TODO:
can we drop padding in-advance?
{
ok
,
Body
,
Rest
,
S
#full_st
{
dec_seq_no
=
SeqNo
+
1
}};
%% TODO:
predict padding size from padding_size(Len)
{
ok
,
Body
,
trim_padding
(
Rest
)
,
S
#full_st
{
dec_seq_no
=
SeqNo
+
1
}};
_
->
{
incomplete
,
S
}
end
;
try_decode_packet
(_,
S
)
->
{
incomplete
,
S
}.
trim_padding
(
<<
4
:
32
/
little
,
Tail
/
binary
>>
)
->
trim_padding
(
Tail
);
trim_padding
(
Bin
)
->
Bin
.
encode_packet
(
Bin
,
#full_st
{
enc_seq_no
=
SeqNo
}
=
S
)
->
BodySize
=
iolist_size
(
Bin
),
...
...
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