-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codec: rpc: clean up API usage to support buffered use (for performance)
Previously, we internally created buffered reader and writer off the passed io.ReadWriteCloser got from the socket connection. This is limiting, as it might read more bytes than is necessary for the stream into an internal buffer that the user is not aware of. Instead, we now just use the ReadWriteCloser as is, and ask the user to explicitly pass a buffered ReadWriteCloser if desired. To assist, we provide a ReadWriteCloser implementation that can be buffered (see NewReadWriteCloser function). Typical use-case can now be: var conn io.ReadWriteCloser // connection got from a socket conn2 := codec.NewReadWriteCloser(conn, conn, 1024, 1024) // wrapped in 1024-byte bufer var h = GoRpc.ServerCodec(conn2, handle) Updates #113 Fixes #216
- Loading branch information
Showing
6 changed files
with
148 additions
and
20 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
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 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