LEFT | RIGHT |
(no file at all) | |
1 // Copyright 2010 The Go Authors. All rights reserved. | 1 // Copyright 2010 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 // TLS low level connection and record layer | 5 // TLS low level connection and record layer |
6 | 6 |
7 package tls | 7 package tls |
8 | 8 |
9 import ( | 9 import ( |
10 "bytes" | 10 "bytes" |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 func (c *Conn) SetDeadline(t time.Time) error { | 75 func (c *Conn) SetDeadline(t time.Time) error { |
76 return c.conn.SetDeadline(t) | 76 return c.conn.SetDeadline(t) |
77 } | 77 } |
78 | 78 |
79 // SetReadDeadline sets the read deadline on the underlying connection. | 79 // SetReadDeadline sets the read deadline on the underlying connection. |
80 // A zero value for t means Read will not time out. | 80 // A zero value for t means Read will not time out. |
81 func (c *Conn) SetReadDeadline(t time.Time) error { | 81 func (c *Conn) SetReadDeadline(t time.Time) error { |
82 return c.conn.SetReadDeadline(t) | 82 return c.conn.SetReadDeadline(t) |
83 } | 83 } |
84 | 84 |
85 // SetWriteDeadline sets the write deadline on the underlying conneciton. | 85 // SetWriteDeadline sets the write deadline on the underlying connection. |
86 // A zero value for t means Write will not time out. | 86 // A zero value for t means Write will not time out. |
87 // After a Write has timed out, the TLS state is corrupt and all future writes w
ill return the same error. | 87 // After a Write has timed out, the TLS state is corrupt and all future writes w
ill return the same error. |
88 func (c *Conn) SetWriteDeadline(t time.Time) error { | 88 func (c *Conn) SetWriteDeadline(t time.Time) error { |
89 return c.conn.SetWriteDeadline(t) | 89 return c.conn.SetWriteDeadline(t) |
90 } | 90 } |
91 | 91 |
92 // A halfConn represents one direction of the record layer | 92 // A halfConn represents one direction of the record layer |
93 // connection, either sending or receiving. | 93 // connection, either sending or receiving. |
94 type halfConn struct { | 94 type halfConn struct { |
95 sync.Mutex | 95 sync.Mutex |
(...skipping 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1015 c.handshakeMutex.Lock() | 1015 c.handshakeMutex.Lock() |
1016 defer c.handshakeMutex.Unlock() | 1016 defer c.handshakeMutex.Unlock() |
1017 if !c.isClient { | 1017 if !c.isClient { |
1018 return errors.New("tls: VerifyHostname called on TLS server conn
ection") | 1018 return errors.New("tls: VerifyHostname called on TLS server conn
ection") |
1019 } | 1019 } |
1020 if !c.handshakeComplete { | 1020 if !c.handshakeComplete { |
1021 return errors.New("tls: handshake has not yet been performed") | 1021 return errors.New("tls: handshake has not yet been performed") |
1022 } | 1022 } |
1023 return c.peerCertificates[0].VerifyHostname(host) | 1023 return c.peerCertificates[0].VerifyHostname(host) |
1024 } | 1024 } |
LEFT | RIGHT |