Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Retry a few times if a recv() call on a socket on which a message is being received returns WSAWOULDBLOCK. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
8954abdf102510712ce66fb08b2ed370 |
User & Date: | dan 2022-03-28 17:28:05.622 |
Context
2022-04-02
| ||
15:32 | Modify project so that there are two ways to access databases stored in the cloud - directly, for single-process read/write access, and via a daemon process, for multi-process read-only deployments. check-in: f01d3d41d9 user: dan tags: trunk | |
15:16 | Move the original, daemon-only, version of blockcachevfs to this branch. Leaf check-in: 628612ec23 user: dan tags: daemon-only | |
2022-03-28
| ||
17:28 | Retry a few times if a recv() call on a socket on which a message is being received returns WSAWOULDBLOCK. check-in: 8954abdf10 user: dan tags: trunk | |
15:55 | Add extra debugging logging for winsock errors. check-in: 59506d815f user: dan tags: trunk | |
Changes
Changes to src/blockcachevfs.c.
︙ | ︙ | |||
307 308 309 310 311 312 313 | ){ *pxRecv = bcv_socket_api.xRecv; *pxSend = bcv_socket_api.xSend; bcv_socket_api.xRecv = xRecv; bcv_socket_api.xSend = xSend; } | | > > > > > > > > > > > > > > | 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 | ){ *pxRecv = bcv_socket_api.xRecv; *pxSend = bcv_socket_api.xSend; bcv_socket_api.xRecv = xRecv; bcv_socket_api.xSend = xSend; } static int bcv_recv( BCV_SOCKET_TYPE fd, void *aRead, int nRead ){ u8 *a = (u8*)aRead; int nDone = 0; #ifdef __WIN32__ int nRetry = 0; #endif while( nDone<nRead ){ int res = bcv_socket_api.xRecv(fd, &a[nDone], nRead-nDone); if( res<=0 ){ #ifdef __WIN32__ if( WSAGetLastError()==WSAEWOULDBLOCK ){ nRetry++; if( nRetry>5 ) sqlite3_sleep(1); if( nRetry<1000 ) continue; } #endif return BCV_IOERR; } nDone += res; } return SQLITE_OK; } |
︙ | ︙ |
Changes to src/blockcachevfsd.c.
︙ | ︙ | |||
4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 | static void bdHandleClientMessage( DaemonCtx *p, DClient *pClient, int *pbLogin /* Set to true if message is a LOGIN */ ){ BlockcacheMessage *pMsg = 0; int rc; rc = bcvRecvMsg(pClient->fd, &pMsg); assert( (rc==SQLITE_OK)==(pMsg!=0) ); if( rc ){ #ifdef __WIN32__ int err = WSAGetLastError(); | > > > > > > > > > > > > | > > > | 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 | static void bdHandleClientMessage( DaemonCtx *p, DClient *pClient, int *pbLogin /* Set to true if message is a LOGIN */ ){ BlockcacheMessage *pMsg = 0; int rc; #if defined(__WIN32__) && !defined(NDEBUG) { WSAPOLLFD pfd = {0,0,0}; pfd.fd = pClient->fd; pfd.events = POLLRDNORM; WSAPoll(&pfd, 1, 0); assert( pfd.revents & (POLLIN|POLLHUP) ); } #endif rc = bcvRecvMsg(pClient->fd, &pMsg); assert( (rc==SQLITE_OK)==(pMsg!=0) ); if( rc ){ #ifdef __WIN32__ int err = WSAGetLastError(); if( err!=0 ){ daemon_event_log(p, "WSAGetLastError() returns %d, disconnecting client %d", err, pClient->iClientId ); } #endif bdCloseConnection(p, pClient); }else{ bdLogMessage(p, pClient, pMsg); switch( pMsg->eType ){ case BCV_MESSAGE_LOGIN: { bdHandleClientLogin(p, pClient, pMsg); |
︙ | ︙ |