Skip to content

Commit 1c5d648

Browse files
committed
Add SetActualDataSize public API for pooled messages
Expose SetActualDataSize() as public API to allow setting actual data size after writing directly to Data Span. Added ObjectDisposedException check for safety.
1 parent 9b29292 commit 1c5d648

4 files changed

Lines changed: 19 additions & 3 deletions

File tree

CHANGELOG.ko.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
## [출시 예정]
1111

12+
## [0.4.1] - 2025-12-27
13+
14+
### 추가됨 (Added)
15+
- **SetActualDataSize() public API** - 풀링된 메시지에서 Data Span에 직접 쓴 후 실제 데이터 크기 설정 가능
16+
1217
## [0.4.0] - 2025-12-26
1318

1419
### 추가됨 (Added)

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
## [Unreleased]
1111

12+
## [0.4.1] - 2025-12-27
13+
14+
### Added
15+
- **SetActualDataSize() public API** - Allows setting actual data size after writing directly to Data Span in pooled messages
16+
1217
## [0.4.0] - 2025-12-26
1318

1419
### Added

Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
99

1010
<!-- Version Management -->
11-
<VersionPrefix>0.3.1</VersionPrefix>
11+
<VersionPrefix>0.4.1</VersionPrefix>
1212

1313
<!-- Package Metadata -->
1414
<Authors>ulala-x</Authors>

src/Net.Zmq/Message.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,17 @@ internal void PrepareForReuse()
504504

505505
/// <summary>
506506
/// Pooled 메시지의 실제 데이터 크기를 설정합니다.
507+
/// Data Span에 직접 데이터를 쓴 후 실제 크기를 설정할 때 사용합니다.
507508
/// </summary>
508509
/// <param name="size">실제 데이터 크기</param>
509-
/// <exception cref="ArgumentException">실제 크기가 버퍼 크기를 초과하는 경우</exception>
510-
internal void SetActualDataSize(int size)
510+
/// <exception cref="ObjectDisposedException">메시지가 이미 Dispose된 경우</exception>
511+
/// <exception cref="InvalidOperationException">풀에서 가져온 메시지가 아닌 경우</exception>
512+
/// <exception cref="ArgumentException">실제 크기가 버퍼 크기를 초과하거나 음수인 경우</exception>
513+
public void SetActualDataSize(int size)
511514
{
515+
if (_disposed)
516+
throw new ObjectDisposedException(nameof(Message));
517+
512518
if (!_isFromPool)
513519
throw new InvalidOperationException("SetActualDataSize can only be called on pooled messages");
514520

0 commit comments

Comments
 (0)