Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Kart-Public
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
X.organic
Kart-Public
Commits
17444e19
Commit
17444e19
authored
Nov 1, 2022
by
SteelT
Browse files
Options
Downloads
Plain Diff
Merge branch 'internal16fixes' of
https://git.do.srb2.org/KartKrew/Kart
into internal16fixes
parents
3a720a61
234bdc90
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/d_netfil.c
+21
-7
21 additions, 7 deletions
src/d_netfil.c
with
21 additions
and
7 deletions
src/d_netfil.c
+
21
−
7
View file @
17444e19
...
...
@@ -358,6 +358,10 @@ tryagain:
skippedafile
=
-
1
;
#endif
#ifdef VERBOSEREQUESTFILE
CONS_Printf
(
"Preparing packet
\n
"
);
#endif
netbuffer
->
packettype
=
PT_REQUESTFILE
;
p
=
(
char
*
)
netbuffer
->
u
.
textcmd
;
...
...
@@ -371,7 +375,7 @@ tryagain:
// Figure out if we'd overrun our buffer.
checklen
=
strlen
(
fileneeded
[
i
].
filename
)
+
2
;
// plus the fileid (and terminator, in case this is last)
if
((
UINT8
*
)(
p
+
checklen
)
>
netbuffer
->
u
.
textcmd
+
MAXTEXTCMD
-
1
)
if
((
UINT8
*
)(
p
+
checklen
)
>
=
netbuffer
->
u
.
textcmd
+
MAXTEXTCMD
)
{
skippedafile
=
i
;
// we might have a shorter file that can fit in the remaining space, and file ID permits out-of-order data
...
...
@@ -382,6 +386,10 @@ tryagain:
WRITEUINT8
(
p
,
i
);
// fileid
WRITESTRINGN
(
p
,
fileneeded
[
i
].
filename
,
MAX_WADPATH
);
#ifdef VERBOSEREQUESTFILE
CONS_Printf
(
" file
\"
%s
\"
(id %d)
\n
"
,
i
,
fileneeded
[
i
].
filename
);
#endif
// put it in download dir
strcatbf
(
fileneeded
[
i
].
filename
,
downloaddir
,
"/"
);
fileneeded
[
i
].
status
=
FS_REQUESTED
;
...
...
@@ -394,14 +402,12 @@ tryagain:
// If we're not trying extralong legacy download requests, gotta bail.
if
(
skippedafile
!=
-
1
)
{
#ifndef MORELEGACYDOWNLOADER
CONS_Printf
(
"Direct download - missing files are as follows:
\n
"
);
for
(
i
=
0
;
i
<
fileneedednum
;
i
++
)
{
if
((
fileneeded
[
i
].
status
==
FS_NOTFOUND
||
fileneeded
[
i
].
status
==
FS_MD5SUMBAD
||
fileneeded
[
i
].
status
==
FS_FALLBACK
||
fileneeded
[
i
].
status
==
FS_REQUESTED
))
// FS_REQUESTED added
CONS_Printf
(
" %s
\n
"
,
fileneeded
[
i
].
filename
);
}
#endif
return
false
;
}
#endif
...
...
@@ -429,6 +435,10 @@ tryagain:
}
#endif
#ifdef VERBOSEREQUESTFILE
CONS_Printf
(
"Returning true
\n
"
);
#endif
return
true
;
}
...
...
@@ -439,14 +449,16 @@ boolean Got_RequestFilePak(INT32 node)
char
wad
[
MAX_WADPATH
+
1
];
UINT8
*
p
=
netbuffer
->
u
.
textcmd
;
UINT8
id
;
while
(
p
<
netbuffer
->
u
.
textcmd
+
MAXTEXTCMD
-
1
)
// Don't allow hacked client to overflow
while
(
p
<
netbuffer
->
u
.
textcmd
+
MAXTEXTCMD
)
// Don't allow hacked client to overflow
{
id
=
READUINT8
(
p
);
if
(
id
==
0xFF
)
break
;
READSTRINGN
(
p
,
wad
,
MAX_WADPATH
);
if
(
p
>=
netbuffer
->
u
.
textcmd
+
MAXTEXTCMD
-
1
||
!
SV_SendFile
(
node
,
wad
,
id
))
if
(
p
>=
netbuffer
->
u
.
textcmd
+
MAXTEXTCMD
||
!
SV_SendFile
(
node
,
wad
,
id
))
{
if
(
cv_noticedownload
.
value
)
CONS_Printf
(
"Bad PT_REQUESTFILE from node %d!
\n
"
,
node
);
SV_AbortSendFiles
(
node
);
return
false
;
// don't read any more
}
...
...
@@ -621,7 +633,7 @@ static boolean SV_SendFile(INT32 node, const char *filename, UINT8 fileid)
char
wadfilename
[
MAX_WADPATH
];
if
(
cv_noticedownload
.
value
)
CONS_Printf
(
"Sending file
\"
%s
\"
to node %d (%s)
\n
"
,
filename
,
node
,
I_GetNodeAddress
(
node
));
CONS_Printf
(
"Sending file
\"
%s
\"
(id %d)
to node %d (%s)
\n
"
,
filename
,
fileid
,
node
,
I_GetNodeAddress
(
node
));
// Find the last file in the list and set a pointer to its "next" field
q
=
&
transfer
[
node
].
txlist
;
...
...
@@ -747,7 +759,7 @@ static void SV_EndFileSend(INT32 node)
{
case
SF_FILE
:
// It's a file, close it and free its filename
if
(
cv_noticedownload
.
value
)
CONS_Printf
(
"Ending file transfer for node %d
\n
"
,
node
);
CONS_Printf
(
"Ending file transfer
(id %d)
for node %d
\n
"
,
p
->
fileid
,
node
);
if
(
transfer
[
node
].
currentfile
)
fclose
(
transfer
[
node
].
currentfile
);
free
(
p
->
id
.
filename
);
...
...
@@ -1019,6 +1031,8 @@ boolean SV_SendingFile(INT32 node)
*/
void
SV_AbortSendFiles
(
INT32
node
)
{
if
(
cv_noticedownload
.
value
)
CONS_Printf
(
"Aborting send files for node %d...
\n
"
,
node
);
while
(
transfer
[
node
].
txlist
)
SV_EndFileSend
(
node
);
}
...
...
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