mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-31 21:28:11 +09:00 
			
		
		
		
	Update to latest mssqldriver (#7613)
* New driver does not tolerate USE - handle this by closing db and reopening db in the new dbname
This commit is contained in:
		
							
								
								
									
										20
									
								
								vendor/github.com/denisenkom/go-mssqldb/net.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										20
									
								
								vendor/github.com/denisenkom/go-mssqldb/net.go
									
									
									
										generated
									
									
										vendored
									
									
								
							| @@ -14,7 +14,7 @@ type timeoutConn struct { | ||||
| 	continueRead  bool | ||||
| } | ||||
|  | ||||
| func NewTimeoutConn(conn net.Conn, timeout time.Duration) *timeoutConn { | ||||
| func newTimeoutConn(conn net.Conn, timeout time.Duration) *timeoutConn { | ||||
| 	return &timeoutConn{ | ||||
| 		c:       conn, | ||||
| 		timeout: timeout, | ||||
| @@ -48,9 +48,11 @@ func (c *timeoutConn) Read(b []byte) (n int, err error) { | ||||
| 		n, err = c.buf.Read(b) | ||||
| 		return | ||||
| 	} | ||||
| 	err = c.c.SetDeadline(time.Now().Add(c.timeout)) | ||||
| 	if err != nil { | ||||
| 		return | ||||
| 	if c.timeout > 0 { | ||||
| 		err = c.c.SetDeadline(time.Now().Add(c.timeout)) | ||||
| 		if err != nil { | ||||
| 			return | ||||
| 		} | ||||
| 	} | ||||
| 	return c.c.Read(b) | ||||
| } | ||||
| @@ -58,7 +60,7 @@ func (c *timeoutConn) Read(b []byte) (n int, err error) { | ||||
| func (c *timeoutConn) Write(b []byte) (n int, err error) { | ||||
| 	if c.buf != nil { | ||||
| 		if !c.packetPending { | ||||
| 			c.buf.BeginPacket(packPrelogin) | ||||
| 			c.buf.BeginPacket(packPrelogin, false) | ||||
| 			c.packetPending = true | ||||
| 		} | ||||
| 		n, err = c.buf.Write(b) | ||||
| @@ -67,9 +69,11 @@ func (c *timeoutConn) Write(b []byte) (n int, err error) { | ||||
| 		} | ||||
| 		return | ||||
| 	} | ||||
| 	err = c.c.SetDeadline(time.Now().Add(c.timeout)) | ||||
| 	if err != nil { | ||||
| 		return | ||||
| 	if c.timeout > 0 { | ||||
| 		err = c.c.SetDeadline(time.Now().Add(c.timeout)) | ||||
| 		if err != nil { | ||||
| 			return | ||||
| 		} | ||||
| 	} | ||||
| 	return c.c.Write(b) | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user