-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplified and organized files/functions utils updated
- Loading branch information
1 parent
9f6e3c4
commit b382b43
Showing
21 changed files
with
801 additions
and
883 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -238,6 +238,7 @@ | |
"error", | ||
"tab", | ||
{ | ||
"SwitchCase": 1, | ||
"ObjectExpression": 1, | ||
"ImportDeclaration": 1 | ||
} | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { isNotNumber, isArray } from '@universalweb/acid'; | ||
import { destroy } from './request/destory.js'; | ||
export async function proccessProtocol(source, rpc, frame, header) { | ||
console.log(`Processing Protocol Packet RPC ${rpc}`); | ||
if (isNotNumber(rpc)) { | ||
source.destroy('Invalid RPC Not a Number'); | ||
return; | ||
} | ||
switch (rpc) { | ||
case 0: | ||
source.intro(frame, header); | ||
break; | ||
default: | ||
console.trace('Unknown Protocol Packet', frame, header); | ||
break; | ||
} | ||
} | ||
export async function proccessProtocolPacketFrame(source, frame, header) { | ||
console.log('Processing Protocol Packet Frame'); | ||
proccessProtocol(source, frame[1], frame, header); | ||
} | ||
export async function proccessProtocolPacketHeader(source, frame, header) { | ||
console.log('Processing Protocol Packet Header'); | ||
if (header && isArray(header)) { | ||
proccessProtocol(source, header[1], frame, header); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
success, failed, imported, msgSent, info | ||
} from '#logs'; | ||
import { | ||
stringify, | ||
hasValue, | ||
isArray, | ||
isNumber | ||
} from '@universalweb/acid'; | ||
import { proccessProtocolPacketFrame } from '#udsp/proccessProtocolPacket'; | ||
export async function processFrame(frame, header, source, queue) { | ||
if (!frame) { | ||
return console.trace(`Invalid Frame Received`); | ||
} | ||
if (isArray(frame) && frame.length) { | ||
const streamId = frame[0]; | ||
info(`Packet Received Stream ID: ${streamId}`); | ||
if (hasValue(streamId)) { | ||
if (streamId === false) { | ||
proccessProtocolPacketFrame(source, frame, header); | ||
return; | ||
} | ||
const requestObject = queue.get(streamId); | ||
if (requestObject) { | ||
requestObject.onFrame(frame, header); | ||
return; | ||
} else { | ||
console.log('None found returning false', frame); | ||
return false; | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.