mirror of
https://github.com/wavetermdev/backup.git
synced 2026-04-22 15:26:58 -07:00
Compare commits
13 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c32f690c6 | |||
| 4b5eccab7c | |||
| a69ac24659 | |||
| fde141fce3 | |||
| 42656ecd71 | |||
| 291f7f61ed | |||
| da76719800 | |||
| 0d8b163b63 | |||
| 8656387329 | |||
| d1baf504ba | |||
| 36de526e8e | |||
| 2acb551f4b | |||
| f87c7a28a6 |
@@ -53,12 +53,6 @@ Install modules (we use yarn):
|
||||
yarn
|
||||
```
|
||||
|
||||
Electron also requires specific builds of node_modules to work (because Electron embeds a specific node.js version that might not match your development node.js version). We use a special electron command to cross-compile those modules:
|
||||
|
||||
```
|
||||
scripthaus run electron-rebuild
|
||||
```
|
||||
|
||||
## Running WebPack
|
||||
|
||||
We use webpack to build both the React and Electron App Wrapper code. They are both run together using:
|
||||
|
||||
@@ -20,7 +20,7 @@ Wave isn't just another terminal emulator; it's a rethink on how terminals are b
|
||||
- CodeEdit, to edit local and remote files with a VSCode-like inline editor
|
||||
- AI Integration with ChatGPT (or ChatGPT compatible APIs) to help write commands and get answers inline
|
||||
|
||||

|
||||

|
||||
|
||||
## Installation
|
||||
|
||||
|
||||
@@ -39,6 +39,14 @@
|
||||
"command": "app:openTabSearchModal",
|
||||
"keys": ["Cmd:p"]
|
||||
},
|
||||
{
|
||||
"command": "app:openConnectionsView",
|
||||
"keys": []
|
||||
},
|
||||
{
|
||||
"command": "app:openSettingsView",
|
||||
"keys": []
|
||||
},
|
||||
{
|
||||
"command": "app:newTab",
|
||||
"keys": ["Cmd:t"]
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 306 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 217 KiB |
@@ -220,6 +220,4 @@
|
||||
--modal-header-bottom-border-color: rgba(241, 246, 243, 0.15);
|
||||
|
||||
--logo-button-hover-bg-color: #1e1e1e;
|
||||
|
||||
--xterm-viewport-border-color: rgba(241, 246, 243, 0.15);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,4 @@
|
||||
--toggle-thumb-color: var(--app-bg-color);
|
||||
|
||||
--logo-button-hover-bg-color: #f0f0f0;
|
||||
|
||||
--xterm-viewport-border-color: rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
:root {
|
||||
/*
|
||||
* term colors (16 + 2) form the base terminal theme
|
||||
* term colors (16 + 5) form the base terminal theme
|
||||
* for consistency these colors should be used by plugins/applications
|
||||
*/
|
||||
--term-black: #000000;
|
||||
@@ -27,4 +27,5 @@
|
||||
--term-cmdtext: #ffffff;
|
||||
--term-foreground: #d3d7cf;
|
||||
--term-background: #000000;
|
||||
--term-selection-background: #ffffff40;
|
||||
}
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
--term-foreground: #000000;
|
||||
--term-background: #fefefe;
|
||||
--term-cmdtext: #000000;
|
||||
--term-selection-background: #00000018;
|
||||
}
|
||||
|
||||
@@ -90,25 +90,12 @@
|
||||
margin-top: 5px;
|
||||
overflow-x: auto;
|
||||
overflow-y: hidden;
|
||||
border: 1px solid var(--app-border-color);
|
||||
border-radius: 6px;
|
||||
padding: 6px 10px;
|
||||
|
||||
.terminal-connectelem {
|
||||
height: 163px !important; // Needed to override plugin height
|
||||
|
||||
.xterm-viewport {
|
||||
display: flex;
|
||||
padding: 6px 10px;
|
||||
gap: 8px;
|
||||
align-items: flex-start;
|
||||
align-self: stretch;
|
||||
border-radius: 6px;
|
||||
border: 1px solid var(--xterm-viewport-border-color);
|
||||
background: #080a08;
|
||||
height: 163px !important; // Needed to override plugin height
|
||||
}
|
||||
|
||||
.xterm-screen {
|
||||
padding: 10px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-18
@@ -355,13 +355,6 @@ function createMainWindow(clientData: ClientDataType | null): Electron.BrowserWi
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:i")) {
|
||||
e.preventDefault();
|
||||
if (!input.alt) {
|
||||
win.webContents.send("i-cmd", mods);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:r")) {
|
||||
e.preventDefault();
|
||||
win.webContents.send("r-cmd", mods);
|
||||
@@ -377,16 +370,6 @@ function createMainWindow(clientData: ClientDataType | null): Electron.BrowserWi
|
||||
win.webContents.send("w-cmd", mods);
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:h")) {
|
||||
win.webContents.send("h-cmd", mods);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:p")) {
|
||||
win.webContents.send("p-cmd", mods);
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:ArrowUp") || checkKeyPressed(waveEvent, "Cmd:ArrowDown")) {
|
||||
if (checkKeyPressed(waveEvent, "Cmd:ArrowUp")) {
|
||||
win.webContents.send("meta-arrowup");
|
||||
@@ -405,7 +388,7 @@ function createMainWindow(clientData: ClientDataType | null): Electron.BrowserWi
|
||||
e.preventDefault();
|
||||
return;
|
||||
}
|
||||
if (input.code.startsWith("Digit") && input.meta) {
|
||||
if (input.code.startsWith("Digit") && input.meta && !input.control) {
|
||||
const digitNum = parseInt(input.code.substring(5));
|
||||
if (isNaN(digitNum) || digitNum < 1 || digitNum > 9) {
|
||||
return;
|
||||
|
||||
@@ -21,11 +21,8 @@ contextBridge.exposeInMainWorld("api", {
|
||||
getAppUpdateStatus: () => ipcRenderer.sendSync("get-app-update-status"),
|
||||
onAppUpdateStatus: (callback) => ipcRenderer.on("app-update-status", (_, val) => callback(val)),
|
||||
onTCmd: (callback) => ipcRenderer.on("t-cmd", callback),
|
||||
onICmd: (callback) => ipcRenderer.on("i-cmd", callback),
|
||||
onLCmd: (callback) => ipcRenderer.on("l-cmd", callback),
|
||||
onHCmd: (callback) => ipcRenderer.on("h-cmd", callback),
|
||||
onWCmd: (callback) => ipcRenderer.on("w-cmd", callback),
|
||||
onPCmd: (callback) => ipcRenderer.on("p-cmd", callback),
|
||||
onRCmd: (callback) => ipcRenderer.on("r-cmd", callback),
|
||||
onZoomChanged: (callback) => ipcRenderer.on("zoom-changed", callback),
|
||||
onMetaArrowUp: (callback) => ipcRenderer.on("meta-arrowup", callback),
|
||||
|
||||
@@ -304,6 +304,10 @@ class CommandRunner {
|
||||
GlobalModel.clientSettingsViewModel.showClientSettingsView();
|
||||
}
|
||||
|
||||
syncShellState() {
|
||||
GlobalModel.submitCommand("sync", null, null, { nohist: "1" }, false);
|
||||
}
|
||||
|
||||
historyView(params: HistorySearchParams) {
|
||||
let kwargs = { nohist: "1" };
|
||||
kwargs["offset"] = String(params.offset);
|
||||
|
||||
+107
-53
@@ -146,6 +146,7 @@ class Model {
|
||||
this.keybindManager = new KeybindManager();
|
||||
this.readConfigKeybindings();
|
||||
this.initSystemKeybindings();
|
||||
this.initAppKeybindings();
|
||||
this.inputModel = new InputModel(this);
|
||||
this.pluginsModel = new PluginsModel(this);
|
||||
this.bookmarksModel = new BookmarksModel(this);
|
||||
@@ -175,10 +176,7 @@ class Model {
|
||||
return fontSize;
|
||||
});
|
||||
getApi().onTCmd(this.onTCmd.bind(this));
|
||||
getApi().onICmd(this.onICmd.bind(this));
|
||||
getApi().onLCmd(this.onLCmd.bind(this));
|
||||
getApi().onHCmd(this.onHCmd.bind(this));
|
||||
getApi().onPCmd(this.onPCmd.bind(this));
|
||||
getApi().onWCmd(this.onWCmd.bind(this));
|
||||
getApi().onRCmd(this.onRCmd.bind(this));
|
||||
getApi().onZoomChanged(this.onZoomChanged.bind(this));
|
||||
@@ -220,12 +218,49 @@ class Model {
|
||||
}
|
||||
|
||||
initSystemKeybindings() {
|
||||
this.keybindManager.registerKeybinding("system", "electron", "any", (waveEvent) => {
|
||||
if (this.keybindManager.checkKeyPressed(waveEvent, "system:toggleDeveloperTools")) {
|
||||
getApi().toggleDeveloperTools();
|
||||
this.keybindManager.registerKeybinding("system", "electron", "system:toggleDeveloperTools", (waveEvent) => {
|
||||
getApi().toggleDeveloperTools();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
initAppKeybindings() {
|
||||
for (let index = 1; index <= 9; index++) {
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:selectWorkspace-" + index, (waveEvent) => {
|
||||
this.onSwitchSessionCmd(index);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:focusCmdInput", (waveEvent) => {
|
||||
console.log("focus cmd input callback");
|
||||
this.onFocusCmdInputPressed();
|
||||
return true;
|
||||
});
|
||||
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:bookmarkActiveLine", (waveEvent) => {
|
||||
this.onBookmarkViewPressed();
|
||||
return true;
|
||||
});
|
||||
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:openHistory", (waveEvent) => {
|
||||
this.onOpenHistoryPressed();
|
||||
return true;
|
||||
});
|
||||
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:openTabSearchModal", (waveEvent) => {
|
||||
this.onOpenTabSearchModalPressed();
|
||||
return true;
|
||||
});
|
||||
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:openConnectionsView", (waveEvent) => {
|
||||
this.onOpenConnectionsViewPressed();
|
||||
return true;
|
||||
});
|
||||
|
||||
this.keybindManager.registerKeybinding("app", "model", "app:openSettingsView", (waveEvent) => {
|
||||
this.onOpenSettingsViewPressed();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -470,56 +505,49 @@ class Model {
|
||||
}
|
||||
if (this.activeMainView.get() == "bookmarks") {
|
||||
this.bookmarksModel.handleDocKeyDown(e);
|
||||
return;
|
||||
}
|
||||
if (this.activeMainView.get() == "history") {
|
||||
this.historyViewModel.handleDocKeyDown(e);
|
||||
return;
|
||||
}
|
||||
if (this.activeMainView.get() == "connections") {
|
||||
this.historyViewModel.handleDocKeyDown(e);
|
||||
return;
|
||||
}
|
||||
if (this.activeMainView.get() == "clientsettings") {
|
||||
this.historyViewModel.handleDocKeyDown(e);
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
if (this.activeMainView.get() == "webshare") {
|
||||
this.showSessionView();
|
||||
} else {
|
||||
if (checkKeyPressed(waveEvent, "Escape")) {
|
||||
e.preventDefault();
|
||||
if (this.activeMainView.get() == "webshare") {
|
||||
this.showSessionView();
|
||||
return;
|
||||
}
|
||||
if (this.clearModals()) {
|
||||
return;
|
||||
}
|
||||
const inputModel = this.inputModel;
|
||||
inputModel.toggleInfoMsg();
|
||||
if (inputModel.inputMode.get() != null) {
|
||||
inputModel.resetInputMode();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (this.clearModals()) {
|
||||
return;
|
||||
}
|
||||
const inputModel = this.inputModel;
|
||||
inputModel.toggleInfoMsg();
|
||||
if (inputModel.inputMode.get() != null) {
|
||||
inputModel.resetInputMode();
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:b")) {
|
||||
e.preventDefault();
|
||||
GlobalCommandRunner.bookmarksView();
|
||||
}
|
||||
if (this.activeMainView.get() == "session" && checkKeyPressed(waveEvent, "Cmd:Ctrl:s")) {
|
||||
e.preventDefault();
|
||||
const activeScreen = this.getActiveScreen();
|
||||
if (activeScreen != null) {
|
||||
const isSidebarOpen = activeScreen.isSidebarOpen();
|
||||
if (isSidebarOpen) {
|
||||
GlobalCommandRunner.screenSidebarClose();
|
||||
} else {
|
||||
GlobalCommandRunner.screenSidebarOpen();
|
||||
if (this.activeMainView.get() == "session" && checkKeyPressed(waveEvent, "Cmd:Ctrl:s")) {
|
||||
e.preventDefault();
|
||||
const activeScreen = this.getActiveScreen();
|
||||
if (activeScreen != null) {
|
||||
const isSidebarOpen = activeScreen.isSidebarOpen();
|
||||
if (isSidebarOpen) {
|
||||
GlobalCommandRunner.screenSidebarClose();
|
||||
} else {
|
||||
GlobalCommandRunner.screenSidebarOpen();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (checkKeyPressed(waveEvent, "Cmd:d")) {
|
||||
const ranDelete = this.deleteActiveLine();
|
||||
if (ranDelete) {
|
||||
e.preventDefault();
|
||||
if (checkKeyPressed(waveEvent, "Cmd:d")) {
|
||||
const ranDelete = this.deleteActiveLine();
|
||||
if (ranDelete) {
|
||||
e.preventDefault();
|
||||
}
|
||||
}
|
||||
}
|
||||
this.keybindManager.processKeyEvent(e, waveEvent);
|
||||
@@ -719,8 +747,22 @@ class Model {
|
||||
GlobalCommandRunner.createNewScreen();
|
||||
}
|
||||
|
||||
onICmd(e: any, mods: KeyModsType) {
|
||||
this.inputModel.giveFocus();
|
||||
onBookmarkViewPressed() {
|
||||
GlobalCommandRunner.bookmarksView();
|
||||
}
|
||||
|
||||
onFocusCmdInputPressed() {
|
||||
if (this.activeMainView.get() != "session") {
|
||||
mobx.action(() => {
|
||||
this.activeMainView.set("session");
|
||||
setTimeout(() => {
|
||||
// allows for the session view to load
|
||||
this.inputModel.giveFocus();
|
||||
}, 100);
|
||||
})();
|
||||
} else {
|
||||
this.inputModel.giveFocus();
|
||||
}
|
||||
}
|
||||
|
||||
onLCmd(e: any, mods: KeyModsType) {
|
||||
@@ -730,14 +772,22 @@ class Model {
|
||||
}
|
||||
}
|
||||
|
||||
onHCmd(e: any, mods: KeyModsType) {
|
||||
onOpenHistoryPressed() {
|
||||
this.historyViewModel.reSearch();
|
||||
}
|
||||
|
||||
onPCmd(e: any, mods: KeyModsType) {
|
||||
onOpenTabSearchModalPressed() {
|
||||
this.modalsModel.pushModal(appconst.TAB_SWITCHER);
|
||||
}
|
||||
|
||||
onOpenConnectionsViewPressed() {
|
||||
this.activeMainView.set("connections");
|
||||
}
|
||||
|
||||
onOpenSettingsViewPressed() {
|
||||
this.activeMainView.set("clientsettings");
|
||||
}
|
||||
|
||||
getFocusedLine(): LineFocusType {
|
||||
if (this.inputModel.hasFocus()) {
|
||||
return { cmdInputFocus: true };
|
||||
@@ -804,11 +854,12 @@ class Model {
|
||||
}
|
||||
}
|
||||
|
||||
onSwitchSessionCmd(digit: number) {
|
||||
console.log("switching to ", digit);
|
||||
GlobalCommandRunner.switchSession(String(digit));
|
||||
}
|
||||
|
||||
onDigitCmd(e: any, arg: { digit: number }, mods: KeyModsType) {
|
||||
if (mods.meta && mods.ctrl) {
|
||||
GlobalCommandRunner.switchSession(String(arg.digit));
|
||||
return;
|
||||
}
|
||||
GlobalCommandRunner.switchScreen(String(arg.digit));
|
||||
}
|
||||
|
||||
@@ -1035,6 +1086,9 @@ class Model {
|
||||
this.activeMainView.set("session");
|
||||
this.deactivateScreenLines();
|
||||
this.ws.watchScreen(newActiveSessionId, newActiveScreenId);
|
||||
setTimeout(() => {
|
||||
GlobalCommandRunner.syncShellState();
|
||||
}, 100);
|
||||
}
|
||||
} else {
|
||||
console.warn("unknown update", genUpdate);
|
||||
|
||||
@@ -57,6 +57,7 @@ function getThemeFromCSSVars(): ITheme {
|
||||
theme.brightMagenta = rootStyle.getPropertyValue("--term-bright-magenta");
|
||||
theme.brightCyan = rootStyle.getPropertyValue("--term-bright-cyan");
|
||||
theme.brightWhite = rootStyle.getPropertyValue("--term-bright-white");
|
||||
theme.selectionBackground = rootStyle.getPropertyValue("--term-selection-background");
|
||||
return theme;
|
||||
}
|
||||
|
||||
|
||||
Vendored
-3
@@ -896,10 +896,7 @@ declare global {
|
||||
getAppUpdateStatus: () => AppUpdateStatusType;
|
||||
onAppUpdateStatus: (callback: (status: AppUpdateStatusType) => void) => void;
|
||||
onTCmd: (callback: (mods: KeyModsType) => void) => void;
|
||||
onICmd: (callback: (mods: KeyModsType) => void) => void;
|
||||
onLCmd: (callback: (mods: KeyModsType) => void) => void;
|
||||
onHCmd: (callback: (mods: KeyModsType) => void) => void;
|
||||
onPCmd: (callback: (mods: KeyModsType) => void) => void;
|
||||
onRCmd: (callback: (mods: KeyModsType) => void) => void;
|
||||
onWCmd: (callback: (mods: KeyModsType) => void) => void;
|
||||
onZoomChanged: (callback: () => void) => void;
|
||||
|
||||
+1
-3
@@ -3,7 +3,7 @@ import * as mobx from "mobx";
|
||||
import * as electron from "electron";
|
||||
import { parse } from "node:path";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
import defaultKeybindingsFile from "../../assets/keybindings.json";
|
||||
import defaultKeybindingsFile from "../../assets/default-keybindings.json";
|
||||
const defaultKeybindings: KeybindConfig = defaultKeybindingsFile;
|
||||
|
||||
type KeyPressDecl = {
|
||||
@@ -68,7 +68,6 @@ class KeybindManager {
|
||||
let curUserCommand = "";
|
||||
if (this.userKeybindings != null && this.userKeybindings instanceof Array) {
|
||||
try {
|
||||
console.log("setting user keybindings");
|
||||
for (let index = 0; index < this.userKeybindings.length; index++) {
|
||||
let curKeybind = this.userKeybindings[index];
|
||||
if (curKeybind == null) {
|
||||
@@ -97,7 +96,6 @@ class KeybindManager {
|
||||
}
|
||||
}
|
||||
this.keyDescriptionsMap = newKeyDescriptions;
|
||||
console.log("key desc map:", this.keyDescriptionsMap);
|
||||
}
|
||||
|
||||
processLevel(nativeEvent: any, event: WaveKeyboardEvent, keybindsArray: Array<Keybind>): boolean {
|
||||
|
||||
@@ -61,15 +61,7 @@ func handleSingle() {
|
||||
sender.SendErrorResponse(runPacket.ReqId, fmt.Errorf("run packets from server must have a CK: %v", err))
|
||||
}
|
||||
if runPacket.Detached {
|
||||
cmd, startPk, err := shexec.RunCommandDetached(runPacket, sender)
|
||||
if err != nil {
|
||||
sender.SendErrorResponse(runPacket.ReqId, err)
|
||||
return
|
||||
}
|
||||
sender.SendPacket(startPk)
|
||||
sender.Close()
|
||||
sender.WaitForDone()
|
||||
cmd.DetachedWait(startPk)
|
||||
sender.SendErrorResponse(runPacket.ReqId, fmt.Errorf("detached mode not supported"))
|
||||
return
|
||||
} else {
|
||||
shexec.IgnoreSigPipe()
|
||||
|
||||
@@ -1,473 +0,0 @@
|
||||
// Copyright 2023, Command Line Inc.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
package cmdtail
|
||||
|
||||
import (
|
||||
"encoding/base64"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"regexp"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/fsnotify/fsnotify"
|
||||
"github.com/wavetermdev/waveterm/waveshell/pkg/base"
|
||||
"github.com/wavetermdev/waveterm/waveshell/pkg/packet"
|
||||
)
|
||||
|
||||
const MaxDataBytes = 4096
|
||||
const FileTypePty = "ptyout"
|
||||
const FileTypeRun = "runout"
|
||||
|
||||
type Tailer struct {
|
||||
Lock *sync.Mutex
|
||||
WatchList map[base.CommandKey]CmdWatchEntry
|
||||
Watcher *fsnotify.Watcher
|
||||
Sender *packet.PacketSender
|
||||
Gen FileNameGenerator
|
||||
Sessions map[string]bool
|
||||
}
|
||||
|
||||
type TailPos struct {
|
||||
ReqId string
|
||||
Running bool // an active tailer sending data
|
||||
TailPtyPos int64
|
||||
TailRunPos int64
|
||||
Follow bool
|
||||
}
|
||||
|
||||
type CmdWatchEntry struct {
|
||||
CmdKey base.CommandKey
|
||||
FilePtyLen int64
|
||||
FileRunLen int64
|
||||
Tails []TailPos
|
||||
Done bool
|
||||
}
|
||||
|
||||
type FileNameGenerator interface {
|
||||
PtyOutFile(ck base.CommandKey) string
|
||||
RunOutFile(ck base.CommandKey) string
|
||||
SessionDir(sessionId string) string
|
||||
}
|
||||
|
||||
func (w CmdWatchEntry) getTailPos(reqId string) (TailPos, bool) {
|
||||
for _, pos := range w.Tails {
|
||||
if pos.ReqId == reqId {
|
||||
return pos, true
|
||||
}
|
||||
}
|
||||
return TailPos{}, false
|
||||
}
|
||||
|
||||
func (w *CmdWatchEntry) updateTailPos(reqId string, newPos TailPos) {
|
||||
for idx, pos := range w.Tails {
|
||||
if pos.ReqId == reqId {
|
||||
w.Tails[idx] = newPos
|
||||
return
|
||||
}
|
||||
}
|
||||
w.Tails = append(w.Tails, newPos)
|
||||
}
|
||||
|
||||
func (w *CmdWatchEntry) removeTailPos(reqId string) {
|
||||
var newTails []TailPos
|
||||
for _, pos := range w.Tails {
|
||||
if pos.ReqId == reqId {
|
||||
continue
|
||||
}
|
||||
newTails = append(newTails, pos)
|
||||
}
|
||||
w.Tails = newTails
|
||||
}
|
||||
|
||||
func (pos TailPos) IsCurrent(entry CmdWatchEntry) bool {
|
||||
return pos.TailPtyPos >= entry.FilePtyLen && pos.TailRunPos >= entry.FileRunLen
|
||||
}
|
||||
|
||||
func (t *Tailer) updateTailPos_nolock(cmdKey base.CommandKey, reqId string, pos TailPos) {
|
||||
entry, found := t.WatchList[cmdKey]
|
||||
if !found {
|
||||
return
|
||||
}
|
||||
entry.updateTailPos(reqId, pos)
|
||||
t.WatchList[cmdKey] = entry
|
||||
}
|
||||
|
||||
func (t *Tailer) removeTailPos(cmdKey base.CommandKey, reqId string) {
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
t.removeTailPos_nolock(cmdKey, reqId)
|
||||
}
|
||||
|
||||
func (t *Tailer) removeTailPos_nolock(cmdKey base.CommandKey, reqId string) {
|
||||
entry, found := t.WatchList[cmdKey]
|
||||
if !found {
|
||||
return
|
||||
}
|
||||
entry.removeTailPos(reqId)
|
||||
t.WatchList[cmdKey] = entry
|
||||
if len(entry.Tails) == 0 {
|
||||
t.removeWatch_nolock(cmdKey)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tailer) removeWatch_nolock(cmdKey base.CommandKey) {
|
||||
// delete from watchlist, remove watches
|
||||
delete(t.WatchList, cmdKey)
|
||||
t.Watcher.Remove(t.Gen.PtyOutFile(cmdKey))
|
||||
t.Watcher.Remove(t.Gen.RunOutFile(cmdKey))
|
||||
}
|
||||
|
||||
func (t *Tailer) getEntryAndPos_nolock(cmdKey base.CommandKey, reqId string) (CmdWatchEntry, TailPos, bool) {
|
||||
entry, found := t.WatchList[cmdKey]
|
||||
if !found {
|
||||
return CmdWatchEntry{}, TailPos{}, false
|
||||
}
|
||||
pos, found := entry.getTailPos(reqId)
|
||||
if !found {
|
||||
return CmdWatchEntry{}, TailPos{}, false
|
||||
}
|
||||
return entry, pos, true
|
||||
}
|
||||
|
||||
func (t *Tailer) addSessionWatcher(sessionId string) error {
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
|
||||
if t.Sessions[sessionId] {
|
||||
return nil
|
||||
}
|
||||
sdir := t.Gen.SessionDir(sessionId)
|
||||
err := t.Watcher.Add(sdir)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.Sessions[sessionId] = true
|
||||
return nil
|
||||
}
|
||||
|
||||
func (t *Tailer) removeSessionWatcher(sessionId string) {
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
|
||||
if !t.Sessions[sessionId] {
|
||||
return
|
||||
}
|
||||
sdir := t.Gen.SessionDir(sessionId)
|
||||
t.Watcher.Remove(sdir)
|
||||
}
|
||||
|
||||
func MakeTailer(sender *packet.PacketSender, gen FileNameGenerator) (*Tailer, error) {
|
||||
rtn := &Tailer{
|
||||
Lock: &sync.Mutex{},
|
||||
WatchList: make(map[base.CommandKey]CmdWatchEntry),
|
||||
Sessions: make(map[string]bool),
|
||||
Sender: sender,
|
||||
Gen: gen,
|
||||
}
|
||||
var err error
|
||||
rtn.Watcher, err = fsnotify.NewWatcher()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return rtn, nil
|
||||
}
|
||||
|
||||
func (t *Tailer) readDataFromFile(fileName string, pos int64, maxBytes int) ([]byte, error) {
|
||||
fd, err := os.Open(fileName)
|
||||
defer fd.Close()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
buf := make([]byte, maxBytes)
|
||||
nr, err := fd.ReadAt(buf, pos)
|
||||
if err != nil && err != io.EOF { // ignore EOF error
|
||||
return nil, err
|
||||
}
|
||||
return buf[0:nr], nil
|
||||
}
|
||||
|
||||
func (t *Tailer) makeCmdDataPacket(entry CmdWatchEntry, pos TailPos) (*packet.CmdDataPacketType, error) {
|
||||
dataPacket := packet.MakeCmdDataPacket(pos.ReqId)
|
||||
dataPacket.CK = entry.CmdKey
|
||||
dataPacket.PtyPos = pos.TailPtyPos
|
||||
dataPacket.RunPos = pos.TailRunPos
|
||||
if entry.FilePtyLen > pos.TailPtyPos {
|
||||
ptyData, err := t.readDataFromFile(t.Gen.PtyOutFile(entry.CmdKey), pos.TailPtyPos, MaxDataBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataPacket.PtyData64 = base64.StdEncoding.EncodeToString(ptyData)
|
||||
dataPacket.PtyDataLen = len(ptyData)
|
||||
}
|
||||
if entry.FileRunLen > pos.TailRunPos {
|
||||
runData, err := t.readDataFromFile(t.Gen.RunOutFile(entry.CmdKey), pos.TailRunPos, MaxDataBytes)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dataPacket.RunData64 = base64.StdEncoding.EncodeToString(runData)
|
||||
dataPacket.RunDataLen = len(runData)
|
||||
}
|
||||
return dataPacket, nil
|
||||
}
|
||||
|
||||
// returns (data-packet, keepRunning)
|
||||
func (t *Tailer) runSingleDataTransfer(key base.CommandKey, reqId string) (*packet.CmdDataPacketType, bool, error) {
|
||||
t.Lock.Lock()
|
||||
entry, pos, foundPos := t.getEntryAndPos_nolock(key, reqId)
|
||||
t.Lock.Unlock()
|
||||
if !foundPos {
|
||||
return nil, false, nil
|
||||
}
|
||||
dataPacket, dataErr := t.makeCmdDataPacket(entry, pos)
|
||||
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
entry, pos, foundPos = t.getEntryAndPos_nolock(key, reqId)
|
||||
if !foundPos {
|
||||
return nil, false, nil
|
||||
}
|
||||
// pos was updated between first and second get, throw out data-packet and re-run
|
||||
if pos.TailPtyPos != dataPacket.PtyPos || pos.TailRunPos != dataPacket.RunPos {
|
||||
return nil, true, nil
|
||||
}
|
||||
if dataErr != nil {
|
||||
// error, so return error packet, and stop running
|
||||
pos.Running = false
|
||||
t.updateTailPos_nolock(key, reqId, pos)
|
||||
return nil, false, dataErr
|
||||
}
|
||||
pos.TailPtyPos += int64(dataPacket.PtyDataLen)
|
||||
pos.TailRunPos += int64(dataPacket.RunDataLen)
|
||||
if pos.IsCurrent(entry) {
|
||||
// we caught up, tail position equals file length
|
||||
pos.Running = false
|
||||
}
|
||||
t.updateTailPos_nolock(key, reqId, pos)
|
||||
return dataPacket, pos.Running, nil
|
||||
}
|
||||
|
||||
// returns (removed)
|
||||
func (t *Tailer) checkRemove(cmdKey base.CommandKey, reqId string) bool {
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
entry, pos, foundPos := t.getEntryAndPos_nolock(cmdKey, reqId)
|
||||
if !foundPos {
|
||||
return false
|
||||
}
|
||||
if !pos.IsCurrent(entry) {
|
||||
return false
|
||||
}
|
||||
if !pos.Follow || entry.Done {
|
||||
t.removeTailPos_nolock(cmdKey, reqId)
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (t *Tailer) RunDataTransfer(key base.CommandKey, reqId string) {
|
||||
for {
|
||||
dataPacket, keepRunning, err := t.runSingleDataTransfer(key, reqId)
|
||||
if dataPacket != nil {
|
||||
t.Sender.SendPacket(dataPacket)
|
||||
}
|
||||
if err != nil {
|
||||
t.removeTailPos(key, reqId)
|
||||
t.Sender.SendErrorResponse(reqId, err)
|
||||
break
|
||||
}
|
||||
if !keepRunning {
|
||||
removed := t.checkRemove(key, reqId)
|
||||
if removed {
|
||||
t.Sender.SendResponse(reqId, true)
|
||||
}
|
||||
break
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tailer) tryStartRun_nolock(entry CmdWatchEntry, pos TailPos) {
|
||||
if pos.Running {
|
||||
return
|
||||
}
|
||||
if pos.IsCurrent(entry) {
|
||||
return
|
||||
}
|
||||
pos.Running = true
|
||||
t.updateTailPos_nolock(entry.CmdKey, pos.ReqId, pos)
|
||||
go t.RunDataTransfer(entry.CmdKey, pos.ReqId)
|
||||
}
|
||||
|
||||
var updateFileRe = regexp.MustCompile("/([a-z0-9-]+)/([a-z0-9-]+)\\.(ptyout|runout)$")
|
||||
|
||||
func (t *Tailer) updateFile(relFileName string) {
|
||||
m := updateFileRe.FindStringSubmatch(relFileName)
|
||||
if m == nil {
|
||||
return
|
||||
}
|
||||
finfo, err := os.Stat(relFileName)
|
||||
if err != nil {
|
||||
t.Sender.SendPacket(packet.FmtMessagePacket("error trying to stat file '%s': %v", relFileName, err))
|
||||
return
|
||||
}
|
||||
cmdKey := base.MakeCommandKey(m[1], m[2])
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
entry, foundEntry := t.WatchList[cmdKey]
|
||||
if !foundEntry {
|
||||
return
|
||||
}
|
||||
fileType := m[3]
|
||||
if fileType == FileTypePty {
|
||||
entry.FilePtyLen = finfo.Size()
|
||||
} else if fileType == FileTypeRun {
|
||||
entry.FileRunLen = finfo.Size()
|
||||
}
|
||||
t.WatchList[cmdKey] = entry
|
||||
for _, pos := range entry.Tails {
|
||||
t.tryStartRun_nolock(entry, pos)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tailer) Run() {
|
||||
for {
|
||||
select {
|
||||
case event, ok := <-t.Watcher.Events:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
if event.Op&fsnotify.Write == fsnotify.Write {
|
||||
t.updateFile(event.Name)
|
||||
}
|
||||
|
||||
case err, ok := <-t.Watcher.Errors:
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
// what to do with this error? just send a message
|
||||
t.Sender.SendPacket(packet.FmtMessagePacket("error in tailer: %v", err))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tailer) Close() error {
|
||||
return t.Watcher.Close()
|
||||
}
|
||||
|
||||
func max(v1 int64, v2 int64) int64 {
|
||||
if v1 > v2 {
|
||||
return v1
|
||||
}
|
||||
return v2
|
||||
}
|
||||
|
||||
func (entry *CmdWatchEntry) fillFilePos(gen FileNameGenerator) {
|
||||
ptyInfo, _ := os.Stat(gen.PtyOutFile(entry.CmdKey))
|
||||
if ptyInfo != nil {
|
||||
entry.FilePtyLen = ptyInfo.Size()
|
||||
}
|
||||
runoutInfo, _ := os.Stat(gen.RunOutFile(entry.CmdKey))
|
||||
if runoutInfo != nil {
|
||||
entry.FileRunLen = runoutInfo.Size()
|
||||
}
|
||||
}
|
||||
|
||||
func (t *Tailer) KeyDone(key base.CommandKey) {
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
entry, foundEntry := t.WatchList[key]
|
||||
if !foundEntry {
|
||||
return
|
||||
}
|
||||
entry.Done = true
|
||||
var newTails []TailPos
|
||||
for _, pos := range entry.Tails {
|
||||
if pos.IsCurrent(entry) {
|
||||
continue
|
||||
}
|
||||
newTails = append(newTails, pos)
|
||||
}
|
||||
entry.Tails = newTails
|
||||
t.WatchList[key] = entry
|
||||
if len(entry.Tails) == 0 {
|
||||
t.removeWatch_nolock(key)
|
||||
}
|
||||
t.WatchList[key] = entry
|
||||
}
|
||||
|
||||
func (t *Tailer) RemoveWatch(pk *packet.UntailCmdPacketType) {
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
t.removeTailPos_nolock(pk.CK, pk.ReqId)
|
||||
}
|
||||
|
||||
func (t *Tailer) AddFileWatches_nolock(key base.CommandKey, ptyOnly bool) error {
|
||||
ptyName := t.Gen.PtyOutFile(key)
|
||||
runName := t.Gen.RunOutFile(key)
|
||||
fmt.Printf("WATCH> add %s\n", ptyName)
|
||||
err := t.Watcher.Add(ptyName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if ptyOnly {
|
||||
return nil
|
||||
}
|
||||
err = t.Watcher.Add(runName)
|
||||
if err != nil {
|
||||
t.Watcher.Remove(ptyName) // best effort clean up
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// returns (up-to-date/done, error)
|
||||
func (t *Tailer) AddWatch(getPacket *packet.GetCmdPacketType) (bool, error) {
|
||||
if err := getPacket.CK.Validate("getcmd"); err != nil {
|
||||
return false, err
|
||||
}
|
||||
if getPacket.ReqId == "" {
|
||||
return false, fmt.Errorf("getcmd, no reqid specified")
|
||||
}
|
||||
t.Lock.Lock()
|
||||
defer t.Lock.Unlock()
|
||||
key := getPacket.CK
|
||||
entry, foundEntry := t.WatchList[key]
|
||||
if !foundEntry {
|
||||
// initialize entry, add watches
|
||||
entry = CmdWatchEntry{CmdKey: key}
|
||||
entry.fillFilePos(t.Gen)
|
||||
}
|
||||
pos, foundPos := entry.getTailPos(getPacket.ReqId)
|
||||
if !foundPos {
|
||||
// initialize a new tailpos
|
||||
pos = TailPos{ReqId: getPacket.ReqId}
|
||||
}
|
||||
// update tailpos with new values from getpacket
|
||||
pos.TailPtyPos = getPacket.PtyPos
|
||||
pos.TailRunPos = getPacket.RunPos
|
||||
pos.Follow = getPacket.Tail
|
||||
// convert negative pos to positive
|
||||
if pos.TailPtyPos < 0 {
|
||||
pos.TailPtyPos = max(0, entry.FilePtyLen+pos.TailPtyPos) // + because negative
|
||||
}
|
||||
if pos.TailRunPos < 0 {
|
||||
pos.TailRunPos = max(0, entry.FileRunLen+pos.TailRunPos) // + because negative
|
||||
}
|
||||
entry.updateTailPos(pos.ReqId, pos)
|
||||
if !pos.Follow && pos.IsCurrent(entry) {
|
||||
// don't add to t.WatchList, don't t.AddFileWatches_nolock, send rpc response
|
||||
return true, nil
|
||||
}
|
||||
if !foundEntry {
|
||||
err := t.AddFileWatches_nolock(key, getPacket.PtyOnly)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
}
|
||||
t.WatchList[key] = entry
|
||||
t.tryStartRun_nolock(entry, pos)
|
||||
return false, nil
|
||||
}
|
||||
@@ -43,12 +43,10 @@ const (
|
||||
DataEndPacketStr = "dataend"
|
||||
ResponsePacketStr = "resp" // rpc-response
|
||||
DonePacketStr = "done"
|
||||
CmdErrorPacketStr = "cmderror" // command
|
||||
MessagePacketStr = "message"
|
||||
GetCmdPacketStr = "getcmd" // rpc
|
||||
UntailCmdPacketStr = "untailcmd" // rpc
|
||||
CdPacketStr = "cd" // rpc
|
||||
CmdDataPacketStr = "cmddata" // rpc-response
|
||||
RawPacketStr = "raw"
|
||||
SpecialInputPacketStr = "sinput" // command
|
||||
CompGenPacketStr = "compgen" // rpc
|
||||
@@ -90,7 +88,6 @@ func init() {
|
||||
TypeStrToFactory[PingPacketStr] = reflect.TypeOf(PingPacketType{})
|
||||
TypeStrToFactory[ResponsePacketStr] = reflect.TypeOf(ResponsePacketType{})
|
||||
TypeStrToFactory[DonePacketStr] = reflect.TypeOf(DonePacketType{})
|
||||
TypeStrToFactory[CmdErrorPacketStr] = reflect.TypeOf(CmdErrorPacketType{})
|
||||
TypeStrToFactory[MessagePacketStr] = reflect.TypeOf(MessagePacketType{})
|
||||
TypeStrToFactory[CmdStartPacketStr] = reflect.TypeOf(CmdStartPacketType{})
|
||||
TypeStrToFactory[CmdDonePacketStr] = reflect.TypeOf(CmdDonePacketType{})
|
||||
@@ -98,7 +95,6 @@ func init() {
|
||||
TypeStrToFactory[UntailCmdPacketStr] = reflect.TypeOf(UntailCmdPacketType{})
|
||||
TypeStrToFactory[InitPacketStr] = reflect.TypeOf(InitPacketType{})
|
||||
TypeStrToFactory[CdPacketStr] = reflect.TypeOf(CdPacketType{})
|
||||
TypeStrToFactory[CmdDataPacketStr] = reflect.TypeOf(CmdDataPacketType{})
|
||||
TypeStrToFactory[RawPacketStr] = reflect.TypeOf(RawPacketType{})
|
||||
TypeStrToFactory[SpecialInputPacketStr] = reflect.TypeOf(SpecialInputPacketType{})
|
||||
TypeStrToFactory[DataPacketStr] = reflect.TypeOf(DataPacketType{})
|
||||
@@ -128,7 +124,6 @@ func init() {
|
||||
|
||||
var _ RpcResponsePacketType = (*CmdStartPacketType)(nil)
|
||||
var _ RpcResponsePacketType = (*ResponsePacketType)(nil)
|
||||
var _ RpcResponsePacketType = (*CmdDataPacketType)(nil)
|
||||
var _ RpcResponsePacketType = (*StreamFileResponseType)(nil)
|
||||
var _ RpcResponsePacketType = (*FileDataPacketType)(nil)
|
||||
var _ RpcResponsePacketType = (*WriteFileReadyPacketType)(nil)
|
||||
@@ -155,36 +150,6 @@ func MakePacket(packetType string) (PacketType, error) {
|
||||
return rtn.Interface().(PacketType), nil
|
||||
}
|
||||
|
||||
type CmdDataPacketType struct {
|
||||
Type string `json:"type"`
|
||||
RespId string `json:"respid"`
|
||||
CK base.CommandKey `json:"ck"`
|
||||
PtyPos int64 `json:"ptypos"`
|
||||
PtyLen int64 `json:"ptylen"`
|
||||
RunPos int64 `json:"runpos"`
|
||||
RunLen int64 `json:"runlen"`
|
||||
PtyData64 string `json:"ptydata64"`
|
||||
PtyDataLen int `json:"ptydatalen"`
|
||||
RunData64 string `json:"rundata64"`
|
||||
RunDataLen int `json:"rundatalen"`
|
||||
}
|
||||
|
||||
func (*CmdDataPacketType) GetType() string {
|
||||
return CmdDataPacketStr
|
||||
}
|
||||
|
||||
func (p *CmdDataPacketType) GetResponseId() string {
|
||||
return p.RespId
|
||||
}
|
||||
|
||||
func (*CmdDataPacketType) GetResponseDone() bool {
|
||||
return false
|
||||
}
|
||||
|
||||
func MakeCmdDataPacket(reqId string) *CmdDataPacketType {
|
||||
return &CmdDataPacketType{Type: CmdDataPacketStr, RespId: reqId}
|
||||
}
|
||||
|
||||
type PingPacketType struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
@@ -830,28 +795,6 @@ type BarePacketType struct {
|
||||
Type string `json:"type"`
|
||||
}
|
||||
|
||||
type CmdErrorPacketType struct {
|
||||
Type string `json:"type"`
|
||||
CK base.CommandKey `json:"ck"`
|
||||
Error string `json:"error"`
|
||||
}
|
||||
|
||||
func (*CmdErrorPacketType) GetType() string {
|
||||
return CmdErrorPacketStr
|
||||
}
|
||||
|
||||
func (p *CmdErrorPacketType) GetCK() base.CommandKey {
|
||||
return p.CK
|
||||
}
|
||||
|
||||
func (p *CmdErrorPacketType) String() string {
|
||||
return fmt.Sprintf("error[%s]", p.Error)
|
||||
}
|
||||
|
||||
func MakeCmdErrorPacket(ck base.CommandKey, err error) *CmdErrorPacketType {
|
||||
return &CmdErrorPacketType{Type: CmdErrorPacketStr, CK: ck, Error: err.Error()}
|
||||
}
|
||||
|
||||
type WriteFilePacketType struct {
|
||||
Type string `json:"type"`
|
||||
ReqId string `json:"reqid"`
|
||||
@@ -1074,10 +1017,6 @@ func SendPacket(w io.Writer, packet PacketType) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SendCmdError(w io.Writer, ck base.CommandKey, err error) error {
|
||||
return SendPacket(w, MakeCmdErrorPacket(ck, err))
|
||||
}
|
||||
|
||||
type PacketSender struct {
|
||||
Lock *sync.Mutex
|
||||
SendCh chan PacketType
|
||||
@@ -1197,10 +1136,6 @@ func (sender *PacketSender) SendPacket(pk PacketType) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (sender *PacketSender) SendCmdError(ck base.CommandKey, err error) error {
|
||||
return sender.SendPacket(MakeCmdErrorPacket(ck, err))
|
||||
}
|
||||
|
||||
func (sender *PacketSender) SendErrorResponse(reqId string, err error) error {
|
||||
pk := MakeErrorResponsePacket(reqId, err)
|
||||
return sender.SendPacket(pk)
|
||||
@@ -1222,17 +1157,13 @@ type UnknownPacketReporter interface {
|
||||
type DefaultUPR struct{}
|
||||
|
||||
func (DefaultUPR) UnknownPacket(pk PacketType) {
|
||||
if pk.GetType() == CmdErrorPacketStr {
|
||||
errPacket := pk.(*CmdErrorPacketType)
|
||||
// at this point, just send the error packet to stderr rather than try to do something special
|
||||
fmt.Fprintf(os.Stderr, "[error] %s\n", errPacket.Error)
|
||||
} else if pk.GetType() == RawPacketStr {
|
||||
if pk.GetType() == RawPacketStr {
|
||||
rawPacket := pk.(*RawPacketType)
|
||||
fmt.Fprintf(os.Stderr, "%s\n", rawPacket.Data)
|
||||
} else if pk.GetType() == CmdStartPacketStr {
|
||||
return // do nothing
|
||||
} else {
|
||||
fmt.Fprintf(os.Stderr, "[error] invalid packet received '%s'", AsExtType(pk))
|
||||
wlog.Logf("[upr] invalid packet received '%s'", AsExtType(pk))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user