Fossil

Check-in [31d274d0]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix the socket_receive() function so that it compiles on systems that lack the MSG_DONTWAIT macro (Windows). Such systems lose non-blocking capabilities, but they work otherwise.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | smtp
Files: files | file ages | folders
SHA3-256:31d274d02ea8944c6e2400228a8dba9366baed2fe12c30af1a36fdda8cf277e5
User & Date: drh 2018-07-11 19:46:54
Context
2018-07-11
19:55
The email-server enhancements are far from complete, but they at least compile now on non-linux systems, so it seems safe to merge the existing skeleton to trunk and continue development there where it can be more easily tested on live systems. check-in: 0a201f71 user: drh tags: trunk
19:46
Fix the socket_receive() function so that it compiles on systems that lack the MSG_DONTWAIT macro (Windows). Such systems lose non-blocking capabilities, but they work otherwise. Closed-Leaf check-in: 31d274d0 user: drh tags: smtp
19:41
Add a setup menu option for Email-Server. Try to get the build of this branch working (without DNS support) for non-linux systems. check-in: aa80d694 user: drh tags: smtp
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/http_socket.c.

213
214
215
216
217
218
219

220


221
222
223
224
225
226
227
**
** When bDontBlock is false, this function blocks until all N bytes
** have been read.
*/
size_t socket_receive(void *NotUsed, void *pContent, size_t N, int bDontBlock){
  ssize_t got;
  size_t total = 0;

  int flags = bDontBlock ? MSG_DONTWAIT : 0;


  while( N>0 ){
    /* WinXP fails for large values of N.  So limit it to 64KiB. */
    got = recv(iSocket, pContent, N>65536 ? 65536 : N, flags);
    if( got<=0 ) break;
    total += (size_t)got;
    N -= (size_t)got;
    pContent = (void*)&((char*)pContent)[got];







>
|
>
>







213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
**
** When bDontBlock is false, this function blocks until all N bytes
** have been read.
*/
size_t socket_receive(void *NotUsed, void *pContent, size_t N, int bDontBlock){
  ssize_t got;
  size_t total = 0;
  int flags = 0;
#ifdef MSG_DONTWAIT
  if( bDontBlock ) flags |= MSG_DONTWAIT;
#endif
  while( N>0 ){
    /* WinXP fails for large values of N.  So limit it to 64KiB. */
    got = recv(iSocket, pContent, N>65536 ? 65536 : N, flags);
    if( got<=0 ) break;
    total += (size_t)got;
    N -= (size_t)got;
    pContent = (void*)&((char*)pContent)[got];