Skip to content

fix(examples): repair parser-blocking indentation and frame buffer encoding in EtherSenseServer - #2

Open
magqqgq wants to merge 1 commit into
OpenMind:masterfrom
magqqgq:magqqgq-patch-1
Open

fix(examples): repair parser-blocking indentation and frame buffer encoding in EtherSenseServer#2
magqqgq wants to merge 1 commit into
OpenMind:masterfrom
magqqgq:magqqgq-patch-1

Conversation

@magqqgq

@magqqgq magqqgq commented Aug 27, 2026

Copy link
Copy Markdown

Description

This PR addresses medium-severity code cleanliness and resource handling defects within the librealsense Ethernet client-server example[cite: 16]. It repairs parser-blocking indentation errors, standardizes the transmitted frame buffer to strictly use bytes, and removes an invalid unused accept handler[cite: 16].

Key Changes

  • Executable Correctness (wrappers/python/examples/ethernet_client_server/EtherSenseServer.py):
    • Fixed parser-blocking indentation issues that previously prevented the script from compiling and running[cite: 16].
    • Removed an unused accept-handler path that contained references to undefined data[cite: 16].
  • Resource & Data Handling (EtherSenseServer.py):
    • Initialized self.frame_data as a byte string (b"")[cite: 21].
    • Standardized the update_frame method so that the protocol fields (length, timestamp, and pickled depth data) are consistently packed and concatenated strictly as bytes using struct.pack and pickle.dumps, resolving a previous defect that mixed text and bytes[cite: 16, 21].

Validation & Testing

  • Syntax Validation: The modified Python file successfully passes AST parsing without indentation or syntax errors[cite: 16].
  • Hardware Limitations: Hardware and network-runtime behavior remain unverified because the native RealSense hardware toolchains and device dependencies are unavailable in the current test environment[cite: 16].

…coding in EtherSenseServer

### Description
This PR addresses medium-severity code cleanliness and resource handling defects within the `librealsense` Ethernet client-server example[cite: 16]. It repairs parser-blocking indentation errors, standardizes the transmitted frame buffer to strictly use bytes, and removes an invalid unused accept handler[cite: 16].

### Key Changes
* **Executable Correctness (`wrappers/python/examples/ethernet_client_server/EtherSenseServer.py`):** 
  - Fixed parser-blocking indentation issues that previously prevented the script from compiling and running[cite: 16].
  - Removed an unused accept-handler path that contained references to undefined data[cite: 16].
* **Resource & Data Handling (`EtherSenseServer.py`):** 
  - Initialized `self.frame_data` as a byte string (`b""`)[cite: 21].
  - Standardized the `update_frame` method so that the protocol fields (length, timestamp, and pickled depth data) are consistently packed and concatenated strictly as bytes using `struct.pack` and `pickle.dumps`, resolving a previous defect that mixed text and bytes[cite: 16, 21].

### Validation & Testing
* **Syntax Validation:** The modified Python file successfully passes AST parsing without indentation or syntax errors[cite: 16].
* **Hardware Limitations:** Hardware and network-runtime behavior remain unverified because the native RealSense hardware toolchains and device dependencies are unavailable in the current test environment[cite: 16].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant