Skip to content

Commit

Permalink
zmtp: implement REQ/REP
Browse files Browse the repository at this point in the history
Updates zeromq#65.
  • Loading branch information
sbinet committed Apr 12, 2018
1 parent 2a60b7c commit 1093e05
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions zmtp/socket.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ func NewSocket(socketType SocketType) (Socket, error) {
return dealerSocket{}, nil
case RouterSocketType:
return routerSocket{}, nil
case ReqSocketType:
return reqSocket{}, nil
case RepSocketType:
return repSocket{}, nil
default:
return nil, errors.New("Invalid socket type")
}
Expand Down Expand Up @@ -148,3 +152,41 @@ func (routerSocket) IsCommandTypeValid(name string) bool {
// FIXME(sbinet)
return false
}

type reqSocket struct{}

func (reqSocket) Type() SocketType {
return ReqSocketType
}

func (reqSocket) IsSocketTypeCompatible(socketType SocketType) bool {
switch socketType {
case RepSocketType, RouterSocketType:
return true
}
return false
}

func (reqSocket) IsCommandTypeValid(name string) bool {
// FIXME
return false
}

type repSocket struct{}

func (repSocket) Type() SocketType {
return RepSocketType
}

func (repSocket) IsSocketTypeCompatible(socketType SocketType) bool {
switch socketType {
case ReqSocketType, DealerSocketType:
return true
}
return false
}

func (repSocket) IsCommandTypeValid(name string) bool {
// FIXME
return false
}

0 comments on commit 1093e05

Please sign in to comment.