Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
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
tg
Commits
433ce145
Commit
433ce145
authored
Nov 07, 2013
by
vysheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes some bugs in network
parent
18bc09b2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
7 deletions
+11
-7
mtproto-client.c
mtproto-client.c
+4
-0
net.c
net.c
+4
-3
queries.c
queries.c
+3
-4
No files found.
mtproto-client.c
View file @
433ce145
...
...
@@ -1390,6 +1390,10 @@ int rpc_execute (struct connection *c, int op, int len) {
if
(
verbosity
)
{
logprintf
(
"outbound rpc connection #%d : received rpc answer %d with %d content bytes
\n
"
,
c
->
fd
,
op
,
len
);
}
if
(
op
<
0
)
{
assert
(
read_in
(
c
,
Response
,
Response_len
)
==
Response_len
);
return
0
;
}
if
(
len
>=
MAX_RESPONSE_SIZE
/* - 12*/
||
len
<
0
/*12*/
)
{
logprintf
(
"answer too long (%d bytes), skipping
\n
"
,
len
);
...
...
net.c
View file @
433ce145
...
...
@@ -141,7 +141,7 @@ int read_in (struct connection *c, void *data, int len) {
int
x
=
0
;
while
(
len
)
{
int
y
=
c
->
in_head
->
wptr
-
c
->
in_head
->
rptr
;
if
(
y
>
len
)
{
if
(
y
>
=
len
)
{
memcpy
(
data
,
c
->
in_head
->
rptr
,
len
);
c
->
in_head
->
rptr
+=
len
;
c
->
in_bytes
-=
len
;
...
...
@@ -164,7 +164,7 @@ int read_in (struct connection *c, void *data, int len) {
}
int
read_in_lookup
(
struct
connection
*
c
,
void
*
data
,
int
len
)
{
if
(
!
len
)
{
return
0
;
}
if
(
!
len
||
!
c
->
in_bytes
)
{
return
0
;
}
assert
(
len
>
0
);
if
(
len
>
c
->
in_bytes
)
{
len
=
c
->
in_bytes
;
...
...
@@ -173,12 +173,13 @@ int read_in_lookup (struct connection *c, void *data, int len) {
struct
connection_buffer
*
b
=
c
->
in_head
;
while
(
len
)
{
int
y
=
b
->
wptr
-
b
->
rptr
;
if
(
y
>
len
)
{
if
(
y
>
=
len
)
{
memcpy
(
data
,
b
->
rptr
,
len
);
return
x
+
len
;
}
else
{
memcpy
(
data
,
b
->
rptr
,
y
);
x
+=
y
;
data
+=
y
;
b
=
b
->
next
;
}
}
...
...
queries.c
View file @
433ce145
...
...
@@ -1373,12 +1373,11 @@ void do_send_photo (int type, peer_id_t to_id, char *file_name) {
f
->
size
=
size
;
f
->
offset
=
0
;
f
->
part_num
=
0
;
/* int tmp = ((size + 1999) / 2
000);
int
tmp
=
((
size
+
2999
)
/
3
000
);
f
->
part_size
=
(
1
<<
10
);
while
(
f
->
part_size
<
tmp
)
{
f
->
part_size
*=
2
;
}*/
f
->
part_size
=
256
<<
10
;
}
f
->
id
=
lrand48
()
*
(
1ll
<<
32
)
+
lrand48
();
f
->
to_id
=
to_id
;
...
...
@@ -1398,7 +1397,7 @@ void do_send_photo (int type, peer_id_t to_id, char *file_name) {
((
int
*
)
f
->
key
)[
i
]
=
mrand48
();
}
}
if
(
f
->
part_size
>
=
(
512
<<
10
))
{
if
(
f
->
part_size
>
(
512
<<
10
))
{
close
(
fd
);
rprintf
(
"Too big file. Maximal supported size is %d"
,
(
512
<<
10
)
*
1000
);
return
;
...
...
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