Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with same source UUID on restarting source #1884

Merged
merged 2 commits into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class Provider extends Base {
this._sources.push(
...concat.configuration.map((conf: $.Origin.File.IConfiguration) => {
const observe = new Factory.File()
.source(conf[0])
.alias(conf[0])
.type(conf[1])
.file(conf[2])
.parser(source.observe.parser.instance)
Expand Down
2 changes: 1 addition & 1 deletion application/holder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chipmunk",
"version": "3.9.3",
"version": "3.9.4",
"chipmunk": {
"versions": {}
},
Expand Down
4 changes: 2 additions & 2 deletions application/platform/types/observe/factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,11 @@ export class File extends Factory<File> {
);
}

public source(id: string): File {
public alias(alias: string): File {
if (!(this.observe.origin.instance instanceof $.Origin.File.Configuration)) {
throw new Error(`Given observe object doesn't have File origin`);
}
this.observe.origin.instance.set().source(id);
this.observe.origin.instance.set().alias(alias);
this.updated().origin();
return this;
}
Expand Down
5 changes: 4 additions & 1 deletion application/platform/types/observe/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ export class Observe
}

public clone(): Observe {
return new Observe(this.sterilized());
const cloned = new Observe(this.sterilized());
// Drop alias to prevent multiple observing entries with same UUID
cloned.origin.set().alias();
return cloned;
}

public locker(): {
Expand Down
7 changes: 7 additions & 0 deletions application/platform/types/observe/origin/concat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export class Configuration
defaults(type: Types.File.FileType): Configuration;
push(filename: string, type: Types.File.FileType): Configuration;
remove(filename: string): Configuration;
alias(alias?: string): Configuration;
} {
return {
files: (files: string[]): Configuration => {
Expand All @@ -90,6 +91,12 @@ export class Configuration
}
return this;
},
alias: (alias?: string): Configuration => {
this.configuration.forEach((file) => {
file[0] = alias === undefined ? unique() : alias;
});
return this;
},
};
}

Expand Down
6 changes: 3 additions & 3 deletions application/platform/types/observe/origin/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class Configuration
public set(): {
filename(filename: string): Configuration;
type(type: Types.File.FileType): Configuration;
source(id: string): Configuration;
alias(alias?: string): Configuration;
} {
return {
filename: (filename: string): Configuration => {
Expand All @@ -78,8 +78,8 @@ export class Configuration
this.configuration[1] = type;
return this;
},
source: (id: string): Configuration => {
this.configuration[0] = id;
alias: (alias: string): Configuration => {
this.configuration[0] = alias === undefined ? unique() : alias;
return this;
},
};
Expand Down
15 changes: 13 additions & 2 deletions application/platform/types/observe/origin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ export class Configuration
this.configuration[context] as any,
{
watcher: this.watcher,
overwrite: ((config: IConfiguration) => {
overwrite: (config: IConfiguration) => {
this.overwrite(config);
return this.configuration[context] as any;
})
},
},
);
return this;
Expand Down Expand Up @@ -223,6 +223,17 @@ export class Configuration
}
}

public set(): {
alias(alias?: string): void;
} {
return {
// Change signature of source
alias: (alias?: string): void => {
this.instance.set().alias(alias);
},
};
}

public override storable(): IConfiguration {
return { [this.instance.alias()]: this.instance.storable() };
}
Expand Down
10 changes: 10 additions & 0 deletions application/platform/types/observe/origin/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ export class Configuration
return this.instance.getSupportedParsers();
}

public set(): {
alias(alias?: string): void;
} {
return {
alias: (alias?: string): void => {
this.configuration[0] = alias === undefined ? unique() : alias;
},
};
}

public as<T>(
Ref: { new (...args: any[]): Stream.Declaration } & Alias<unknown>,
): T | undefined {
Expand Down
22 changes: 22 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
# 3.9.4

## Fixes:
- Fix issue with same source UUID on restarting source

# 3.9.3

## Features
- Import / Export filters from context menu on sidebar

## Fixes:
- Fix quick observe setup

# 3.9.2

## Fixes
- Creates suitable source for exporting as raw
- Allows export SomeIp into binary from PcapNg
- Fixes issue with exporting DLT from PcapNg
- Allows attaching to same session text & binary files after concat operation was done
- Fires error on attempt to attach a file to session with linked session file

# 3.9.1

## Fixes
Expand Down
Loading