Compare commits
2 Commits
c4ff4c4835
...
e32520659d
| Author | SHA1 | Date | |
|---|---|---|---|
| e32520659d | |||
| e8eb9d71c2 |
@@ -388,7 +388,7 @@ func (i *jsIPN) run(jsCallbacks js.Value) {
|
|||||||
log.Printf("Could not generate JSON netmap: %v", err)
|
log.Printf("Could not generate JSON netmap: %v", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if n.Prefs.Valid() {
|
if n.Prefs != nil && n.Prefs.Valid() {
|
||||||
jsCallbacks.Call("notifyExitNode", string(n.Prefs.ExitNodeID()))
|
jsCallbacks.Call("notifyExitNode", string(n.Prefs.ExitNodeID()))
|
||||||
}
|
}
|
||||||
if n.BrowseToURL != nil {
|
if n.BrowseToURL != nil {
|
||||||
@@ -405,6 +405,7 @@ func (i *jsIPN) run(jsCallbacks js.Value) {
|
|||||||
Started: f.Started.UnixMilli(),
|
Started: f.Started.UnixMilli(),
|
||||||
DeclaredSize: f.DeclaredSize,
|
DeclaredSize: f.DeclaredSize,
|
||||||
Received: f.Received,
|
Received: f.Received,
|
||||||
|
Done: f.Done,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if b, err := json.Marshal(files); err == nil {
|
if b, err := json.Marshal(files); err == nil {
|
||||||
@@ -967,6 +968,7 @@ type jsIncomingFile struct {
|
|||||||
Started int64 `json:"started"` // Unix milliseconds; use new Date(started) in JS
|
Started int64 `json:"started"` // Unix milliseconds; use new Date(started) in JS
|
||||||
DeclaredSize int64 `json:"declaredSize"` // -1 if unknown
|
DeclaredSize int64 `json:"declaredSize"` // -1 if unknown
|
||||||
Received int64 `json:"received"` // bytes received so far
|
Received int64 `json:"received"` // bytes received so far
|
||||||
|
Done bool `json:"done"` // true once the file has been fully received
|
||||||
}
|
}
|
||||||
|
|
||||||
// jsOutgoingFile is the JSON representation of an outgoing file transfer
|
// jsOutgoingFile is the JSON representation of an outgoing file transfer
|
||||||
|
|||||||
@@ -134,8 +134,9 @@ func (m *manager) PutFile(id clientID, baseName string, r io.Reader, offset, len
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the contents of the file to the writer.
|
// Copy via inFile (which wraps wc) so [incomingFile.Write] can track
|
||||||
copyLength, err := io.Copy(wc, r)
|
// progress and fire periodic sendFileNotify callbacks.
|
||||||
|
copyLength, err := io.Copy(inFile, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, m.redactAndLogError("Copy", err)
|
return 0, m.redactAndLogError("Copy", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user