Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
galene
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
galene
Commits
f66cabd6
Commit
f66cabd6
authored
Mar 23, 2022
by
Juliusz Chroboczek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix file transfer error handling.
parent
8aaa6d14
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
static/galene.js
static/galene.js
+12
-3
No files found.
static/galene.js
View file @
f66cabd6
...
...
@@ -2369,6 +2369,11 @@ TransferredFile.get = function(up, userid, fileid) {
};
TransferredFile
.
prototype
.
close
=
function
()
{
if
(
this
.
dc
)
{
this
.
dc
.
onclose
=
null
;
this
.
dc
.
onerror
=
null
;
this
.
dc
.
onmessage
=
null
;
}
if
(
this
.
pc
)
this
.
pc
.
close
();
this
.
dc
=
null
;
...
...
@@ -2488,6 +2493,8 @@ function setFileStatus(f, status, delyes, delno) {
* @param {any} message
*/
function
failFile
(
f
,
message
)
{
if
(
!
f
.
dc
)
return
;
console
.
error
(
'
File transfer failed:
'
,
message
);
setFileStatus
(
f
,
message
?
`Failed:
${
message
}
`
:
'
Failed.
'
);
f
.
close
();
...
...
@@ -2689,12 +2696,14 @@ async function sendFileData(f) {
async
function
write
(
a
)
{
while
(
f
.
dc
.
bufferedAmount
>
f
.
dc
.
bufferedAmountLowThreshold
)
{
await
new
Promise
((
resolve
,
reject
)
=>
{
if
(
f
.
dc
==
null
)
{
if
(
!
f
.
dc
)
{
reject
(
new
Error
(
'
File is closed.
'
));
return
;
}
f
.
dc
.
onbufferedamountlow
=
function
(
e
)
{
if
(
f
.
dc
==
null
)
{
if
(
!
f
.
dc
)
{
reject
(
new
Error
(
'
File is closed.
'
));
return
;
}
f
.
dc
.
onbufferedamountlow
=
null
;
resolve
();
...
...
@@ -2805,7 +2814,7 @@ async function doneReceiveFileData(f) {
* @param {TransferredFile} f
*/
function
closeReceiveFileData
(
f
)
{
if
(
f
.
datalen
!=
f
.
size
)
{
if
(
f
.
datalen
!=
=
f
.
size
)
{
setFileStatus
(
f
,
'
Failed.
'
,
true
,
true
)
f
.
close
();
}
...
...
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