MCPcopy
hub / github.com/openstf/stf / createServer

Function createServer

lib/units/device/plugins/vnc/index.js:93–130  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

91 }
92
93 function createServer() {
94 log.info('Starting VNC server on port %d', options.vncPort)
95
96 var opts = {
97 name: options.serial
98 , width: options.vncInitialSize[0]
99 , height: options.vncInitialSize[1]
100 , security: [{
101 type: VncConnection.SECURITY_VNC
102 , challenge: new Buffer(16).fill(0)
103 , auth: vncAuthHandler
104 }]
105 }
106
107 var vnc = new VncServer(net.createServer({
108 allowHalfOpen: true
109 }), opts)
110
111 var listeningListener, errorListener
112 return new Promise(function(resolve, reject) {
113 listeningListener = function() {
114 return resolve(vnc)
115 }
116
117 errorListener = function(err) {
118 return reject(err)
119 }
120
121 vnc.on('listening', listeningListener)
122 vnc.on('error', errorListener)
123
124 vnc.listen(options.vncPort)
125 })
126 .finally(function() {
127 vnc.removeListener('listening', listeningListener)
128 vnc.removeListener('error', errorListener)
129 })
130 }
131
132 return createServer()
133 .then(function(vnc) {

Callers 1

index.jsFile · 0.70

Calls 2

resolveFunction · 0.85
rejectFunction · 0.85

Tested by

no test coverage detected