mirror of
https://github.com/openstf/stf
synced 2025-10-06 03:50:04 +02:00
Clean up structure a little bit for initial testing.
This commit is contained in:
parent
6d84064e6b
commit
f7d1b07d1c
3 changed files with 37 additions and 25 deletions
|
@ -1,27 +1,10 @@
|
|||
var net = require('net')
|
||||
var util = require('util')
|
||||
|
||||
var EventEmitter = require('eventemitter3').EventEmitter
|
||||
var debug = require('debug')('vnc')
|
||||
var debug = require('debug')('vnc:connection')
|
||||
|
||||
var PixelFormat = require('./pixelformat')
|
||||
|
||||
function VncServer(server) {
|
||||
this._bound = {
|
||||
_connectionListener: this._connectionListener.bind(this)
|
||||
}
|
||||
|
||||
this.server = server
|
||||
.on('connection', this._bound._connectionListener)
|
||||
}
|
||||
|
||||
util.inherits(VncServer, EventEmitter)
|
||||
|
||||
VncServer.prototype._connectionListener = function(conn) {
|
||||
debug('connection', conn.remoteAddress, conn.remotePort)
|
||||
new VncConnection(conn)
|
||||
}
|
||||
|
||||
function VncConnection(conn) {
|
||||
this._bound = {
|
||||
_readableListener: this._readableListener.bind(this)
|
||||
|
@ -398,10 +381,4 @@ VncConnection.prototype._write = function(chunk) {
|
|||
this.conn.write(chunk)
|
||||
}
|
||||
|
||||
var nserv = net.createServer({
|
||||
allowHalfOpen: true
|
||||
})
|
||||
|
||||
var vserv = new VncServer(nserv)
|
||||
|
||||
nserv.listen(5910)
|
||||
module.exports = VncConnection
|
10
lib/units/device/plugins/vnc/util/example.js
Normal file
10
lib/units/device/plugins/vnc/util/example.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
var net = require('net')
|
||||
var VncServer = require('./server')
|
||||
|
||||
var nserv = net.createServer({
|
||||
allowHalfOpen: true
|
||||
})
|
||||
|
||||
var vserv = new VncServer(nserv)
|
||||
|
||||
nserv.listen(5910)
|
25
lib/units/device/plugins/vnc/util/server.js
Normal file
25
lib/units/device/plugins/vnc/util/server.js
Normal file
|
@ -0,0 +1,25 @@
|
|||
var net = require('net')
|
||||
var util = require('util')
|
||||
|
||||
var EventEmitter = require('eventemitter3').EventEmitter
|
||||
var debug = require('debug')('vnc:server')
|
||||
|
||||
var VncConnection = require('./connection')
|
||||
|
||||
function VncServer(server) {
|
||||
this._bound = {
|
||||
_connectionListener: this._connectionListener.bind(this)
|
||||
}
|
||||
|
||||
this.server = server
|
||||
.on('connection', this._bound._connectionListener)
|
||||
}
|
||||
|
||||
util.inherits(VncServer, EventEmitter)
|
||||
|
||||
VncServer.prototype._connectionListener = function(conn) {
|
||||
debug('connection', conn.remoteAddress, conn.remotePort)
|
||||
new VncConnection(conn)
|
||||
}
|
||||
|
||||
module.exports = VncServer
|
Loading…
Add table
Add a link
Reference in a new issue