Skip to content

Commit cc1e473

Browse files
committed
WebSocketService now can be used as HTTPService
1 parent 43716c5 commit cc1e473

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

rpc/http_service.go

+7-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* *
1313
* hprose http service for Go. *
1414
* *
15-
* LastModified: Nov 1, 2016 *
15+
* LastModified: Nov 24, 2016 *
1616
* Author: Ma Bingyao <[email protected]> *
1717
* *
1818
\**********************************************************/
@@ -80,12 +80,17 @@ func httpFixArguments(args []reflect.Value, context ServiceContext) {
8080
// NewHTTPService is the constructor of HTTPService
8181
func NewHTTPService() (service *HTTPService) {
8282
service = new(HTTPService)
83+
service.InitHTTPService()
84+
return
85+
}
86+
87+
// InitHTTPService initializes HTTPService
88+
func (service *HTTPService) InitHTTPService() {
8389
service.InitBaseHTTPService()
8490
service.contextPool = sync.Pool{
8591
New: func() interface{} { return new(HTTPContext) },
8692
}
8793
service.FixArguments = httpFixArguments
88-
return
8994
}
9095

9196
func (service *HTTPService) acquireContext() (context *HTTPContext) {

rpc/websocket/websocket_service.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* *
1313
* hprose websocket service for Go. *
1414
* *
15-
* LastModified: Nov 1, 2016 *
15+
* LastModified: Nov 24, 2016 *
1616
* Author: Ma Bingyao <[email protected]> *
1717
* *
1818
\**********************************************************/
@@ -75,7 +75,7 @@ func websocketFixArguments(args []reflect.Value, context rpc.ServiceContext) {
7575
// NewWebSocketService is the constructor of WebSocketService
7676
func NewWebSocketService() (service *WebSocketService) {
7777
service = new(WebSocketService)
78-
service.InitBaseHTTPService()
78+
service.InitHTTPService()
7979
service.contextPool = sync.Pool{
8080
New: func() interface{} { return new(WebSocketContext) },
8181
}

0 commit comments

Comments
 (0)