Skip to content

Commit

Permalink
Rename 'Transport.Inject()' to 'Transport.HandleFrame()' in dmsg.
Browse files Browse the repository at this point in the history
  • Loading branch information
林志宇 committed Jun 20, 2019
1 parent 93e2ac5 commit f5cf1bf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/dmsg/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ func (c *ClientConn) Serve(ctx context.Context, accept chan<- *Transport) (err e
// delete tp on any failure.

if tp, ok := c.getTp(id); ok {
if err := tp.Inject(f); err != nil {
if err := tp.HandleFrame(f); err != nil {
log.WithError(err).Warnf("Rejected [%s]: Transport closed.", ft)
}
continue
Expand Down
5 changes: 2 additions & 3 deletions pkg/dmsg/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@ func (tp *Transport) Type() string {
return Type
}

// Inject injects a frame from 'ClientConn' to transport.
// Frame is then handled by 'tp.Serve'.
func (tp *Transport) Inject(f Frame) error {
// HandleFrame allows 'tp.Serve' to handle the frame (typically from 'ClientConn').
func (tp *Transport) HandleFrame(f Frame) error {
if tp.IsClosed() {
return io.ErrClosedPipe
}
Expand Down

0 comments on commit f5cf1bf

Please sign in to comment.