Skip to content

Query may fail on Windows (driver: bad connection) [moved] #2

Closed
@julienschmidt

Description

@julienschmidt

This is Issue 2 moved from a Google Code project.
Added by 2012-05-21T08:15:55.000Z by che...@garena.com.
Please review that bug for more context and additional comments, but update this bug.
Closed (Fixed).

Original labels: Type-Defect, Priority-High, OpSys-Windows

Original description

<b>What steps will reproduce the problem?</b>
1. on Windows
2. Query
<b>3.</b>

<b>What is the expected output? What do you see instead?</b>
expected output: success
actual output: driver: bad connection



<b>What version of the product are you using? On what operating system?</b>


<b>Please provide any additional information below.</b>
Suggested fix:
line 52 of packets.go
    n, e := mc.netconn.Read(data)
    if e != nil || n != int(pktLen) {
        e = driver.ErrBadConn
    }
Here, we assume Read only return when the data is filled. But at least on Go Windows version, it will return prematurely.

So maybe we can change the code to
   n, e := mc.netconn.Read(data)
   na := 0
   for e == nil && n < int(pktLen) {
       na, e = mc.netconn.Read(data[n:])
       n += na
   }

I've verified it on Windows, it works.     

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions