MCPcopy
hub / github.com/agalwood/Motrix / map

Method map

src/main/core/UPnPManager.js:25–51  ·  view source on GitHub ↗
(port)

Source from the content-addressed store, hash-verified

23 }
24
25 map (port) {
26 this.init()
27
28 return new Promise((resolve, reject) => {
29 logger.info('[Motrix] UPnPManager port mapping: ', port)
30 if (!port) {
31 reject(new Error('[Motrix] port was not specified'))
32 return
33 }
34
35 try {
36 client.map(port, (err) => {
37 if (err) {
38 logger.warn(`[Motrix] UPnPManager map ${port} failed, error: `, err.message)
39 reject(err.message)
40 return
41 }
42
43 mappingStatus[port] = true
44 logger.info(`[Motrix] UPnPManager port ${port} mapping succeeded`)
45 resolve()
46 })
47 } catch (err) {
48 reject(err.message)
49 }
50 })
51 }
52
53 unmap (port) {
54 this.init()

Callers 15

fetchListFunction · 0.80
selectAllTaskFunction · 0.80
addUriMethod · 0.80
multicallMethod · 0.80
startUPnPMappingMethod · 0.80
watchUPnPPortsChangeMethod · 0.80
acceleratorForCommandFunction · 0.80
splitTextRowsFunction · 0.80
convertCommaToLineFunction · 0.80
splitTaskLinksFunction · 0.80
listTorrentFilesFunction · 0.80

Calls 1

initMethod · 0.95

Tested by

no test coverage detected