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
ddc04d67
Unverified
Commit
ddc04d67
authored
Jul 25, 2019
by
Sergey Prokhorov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert mtp_full padding changes
parent
1429cfe2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
mtp_full.erl
src/mtp_full.erl
+5
-6
No files found.
src/mtp_full.erl
View file @
ddc04d67
...
...
@@ -38,6 +38,9 @@ new(EncSeqNo, DecSeqNo) ->
#full_st
{
enc_seq_no
=
EncSeqNo
,
dec_seq_no
=
DecSeqNo
}.
try_decode_packet
(
<<
4
:
32
/
little
,
Tail
/
binary
>>
,
S
)
->
%% Skip padding
try_decode_packet
(
Tail
,
S
);
try_decode_packet
(
<<
Len
:
32
/
little
,
PktSeqNo
:
32
/
signed
-
little
,
Tail
/
binary
>>
,
#full_st
{
dec_seq_no
=
SeqNo
}
=
S
)
->
((
Len
rem
byte_size
(
?
PAD
))
==
0
)
...
...
@@ -52,18 +55,14 @@ 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
}),
{
ok
,
Body
,
skip_padding
(
Len
,
Rest
),
S
#full_st
{
dec_seq_no
=
SeqNo
+
1
}};
%% TODO: can we drop padding in-advance?
{
ok
,
Body
,
Rest
,
S
#full_st
{
dec_seq_no
=
SeqNo
+
1
}};
_
->
{
incomplete
,
S
}
end
;
try_decode_packet
(_,
S
)
->
{
incomplete
,
S
}.
skip_padding
(
PktLen
,
Bin
)
->
PaddingSize
=
padding_size
(
PktLen
),
<<
_:
PaddingSize
/
binary
,
Tail
/
binary
>>
=
Bin
,
Tail
.
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