/
stream_service.go
73 lines (63 loc) · 2.26 KB
/
stream_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
/**********************************************************\
| |
| hprose |
| |
| Official WebSite: http://www.hprose.com/ |
| http://www.hprose.org/ |
| |
\**********************************************************/
/**********************************************************\
* *
* hprose/stream_service.go *
* *
* hprose stream service for Go. *
* *
* LastModified: May 25, 2015 *
* Authors: Ma Bingyao <andot@hprose.com> *
* Ore_Ash <nanohugh@gmail.com> *
* *
\**********************************************************/
package hprose
import (
"net"
"time"
)
// StreamService is the base service for TcpService and UnixService
type StreamService struct {
*BaseService
timeout interface{}
readTimeout interface{}
readBuffer interface{}
writeTimeout interface{}
writeBuffer interface{}
}
// StreamContext is the hprose stream context for service
type StreamContext struct {
*BaseContext
net.Conn
}
func newStreamService() (service *StreamService) {
service = new(StreamService)
service.BaseService = NewBaseService()
return
}
// SetTimeout for stream service
func (service *StreamService) SetTimeout(d time.Duration) {
service.timeout = d
}
// SetReadTimeout for stream service
func (service *StreamService) SetReadTimeout(d time.Duration) {
service.readTimeout = d
}
// SetReadBuffer for stream service
func (service *StreamService) SetReadBuffer(bytes int) {
service.readBuffer = bytes
}
// SetWriteTimeout for stream service
func (service *StreamService) SetWriteTimeout(d time.Duration) {
service.writeTimeout = d
}
// SetWriteBuffer for stream service
func (service *StreamService) SetWriteBuffer(bytes int) {
service.writeBuffer = bytes
}