Skip to content

Commit

Permalink
Fix for CONC-455:
Browse files Browse the repository at this point in the history
Value of -1 was incorrect handled when using named pipes. Thanks
to Vladislav Vaintroub for providing this patch.
  • Loading branch information
9EOR9 committed Feb 13, 2020
1 parent 17ba6af commit bc061db
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions plugins/pvio/pvio_npipe.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ my_bool pvio_npipe_set_timeout(MARIADB_PVIO *pvio, enum enum_pvio_timeout type,
else if (timeout <=0)
timeout_ms= -1;
else
timeout_ms = timeout*100;
timeout_ms = timeout*1000;

pvio->timeout[type]= (timeout > 0) ? timeout * 1000 : -1;
pvio->timeout[type]= timeout_ms;
return 0;
}

Expand Down Expand Up @@ -217,7 +217,6 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
PVIO_SET_ERROR(cinfo->mysql, CR_OUT_OF_MEMORY, "HY000", 0, "");
return 1;
}
memset(cpipe, 0, sizeof(struct st_pvio_npipe));
pvio->data= (void *)cpipe;
cpipe->pipe= INVALID_HANDLE_VALUE;
pvio->mysql= cinfo->mysql;
Expand All @@ -237,7 +236,11 @@ my_bool pvio_npipe_connect(MARIADB_PVIO *pvio, MA_PVIO_CINFO *cinfo)
szPipeName[MAX_PATH - 1]= 0;
snprintf(szPipeName, MAX_PATH - 1, "\\\\%s\\pipe\\%s", cinfo->host, cinfo->unix_socket);

deadline = GetTickCount64() + pvio->timeout[PVIO_CONNECT_TIMEOUT];
if (pvio->timeout[PVIO_CONNECT_TIMEOUT] > 0)
deadline = GetTickCount64() + pvio->timeout[PVIO_CONNECT_TIMEOUT];
else
deadline = INFINITE;

while (1)
{
if ((cpipe->pipe = CreateFile(szPipeName,
Expand Down

0 comments on commit bc061db

Please sign in to comment.