mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:53:23 +02:00
Clean up structure a little bit for initial testing.
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user