Skip to content
This repository has been archived by the owner on Sep 27, 2020. It is now read-only.

Commit

Permalink
增加从openvpn网卡获取数据失败时的异常捕获
Browse files Browse the repository at this point in the history
  • Loading branch information
Srar committed Jul 1, 2018
1 parent 845d842 commit e11afa8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,14 @@ async function main() {
filters.push(require("./filters/TimesUDP").default);

async function loop() {
const data: Buffer = await tapControl.read() as Buffer;
let data: Buffer = null;
try {
data = await tapControl.read() as Buffer;
} catch (error) {
console.error("Failed to get data from adapter.", error);
return setImmediate(loop);
}

let index: number = 0;
function next() {
const func = filters[index++];
Expand Down

0 comments on commit e11afa8

Please sign in to comment.