added some error event handlers
This commit is contained in:
		
							parent
							
								
									e259c4d0ce
								
							
						
					
					
						commit
						be6900cd50
					
				| @ -68,7 +68,13 @@ module.exports.create = function (deps, config) { | |||||||
|       return; |       return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  |     function onError(err) { | ||||||
|  |       console.error('[error] socket errored peeking -', err); | ||||||
|  |       conn.destroy(); | ||||||
|  |     } | ||||||
|  |     conn.once('error', onError); | ||||||
|     conn.once('data', function (chunk) { |     conn.once('data', function (chunk) { | ||||||
|  |       conn.removeListener('error', onError); | ||||||
|       peek(conn, chunk, opts); |       peek(conn, chunk, opts); | ||||||
|     }); |     }); | ||||||
|   } |   } | ||||||
|  | |||||||
| @ -183,7 +183,7 @@ module.exports.create = function (deps, config, netHandler) { | |||||||
|   }; |   }; | ||||||
| 
 | 
 | ||||||
|   var terminateServer = tls.createServer(terminatorOpts, function (socket) { |   var terminateServer = tls.createServer(terminatorOpts, function (socket) { | ||||||
|     console.log('(pre-terminated) tls connection, addr:', socket.remoteAddress); |     console.log('(post-terminated) tls connection, addr:', extractSocketProp(socket, 'remoteAddress')); | ||||||
| 
 | 
 | ||||||
|     netHandler(socket, { |     netHandler(socket, { | ||||||
|       servername: socket.servername |       servername: socket.servername | ||||||
| @ -194,6 +194,9 @@ module.exports.create = function (deps, config, netHandler) { | |||||||
|     , remoteFamily:  extractSocketProp(socket, 'remoteFamily') |     , remoteFamily:  extractSocketProp(socket, 'remoteFamily') | ||||||
|     }); |     }); | ||||||
|   }); |   }); | ||||||
|  |   terminateServer.on('error', function (err) { | ||||||
|  |     console.log('[error] TLS termination server', err); | ||||||
|  |   }); | ||||||
| 
 | 
 | ||||||
|   function proxy(socket, opts, mod) { |   function proxy(socket, opts, mod) { | ||||||
|     var newConnOpts = require('../domain-utils').separatePort(mod.address || ''); |     var newConnOpts = require('../domain-utils').separatePort(mod.address || ''); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user