Fossil

Check-in [a67e2683]
Login

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

Overview
Comment:begin work on ticket [bc0d0f5642eaf]: track success of (network) write operations and start bubbling that status up. To make it up to ultimately exit(EXIT_FAILURE) on errors, mkindex will need to be updated, too, as well as the signature from command implementing functions need to return int instead of void at some point. More to come.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | msw-hack
Files: files | file ages | folders
SHA1: a67e2683ed9cdb28f517784252b1d6927a8734e0
User & Date: martin.weber 2011-09-07 03:51:02
Context
2011-09-07
03:51
begin work on ticket [bc0d0f5642eaf]: track success of (network) write operations and start bubbling that status up. To make it up to ultimately exit(EXIT_FAILURE) on errors, mkindex will need to be updated, too, as well as the signature from command implementing functions need to return int instead of void at some point. More to come. Leaf check-in: a67e2683 user: martin.weber tags: msw-hack
2011-09-06
20:12
catch up with trunk. Remove C++ style comments from http_ssl.c. check-in: 0f1c41bc user: martin.weber tags: msw-hack
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/http.c.

188
189
190
191
192
193
194
195

196

197
198
199
200
201
202
203
    transport_log(out);
    free(zOutFile);
  }

  /*
  ** Send the request to the server.
  */
  transport_send(&hdr);

  transport_send(&payload);

  blob_reset(&hdr);
  blob_reset(&payload);
  transport_flip();
  
  /*
  ** Read and interpret the server reply
  */







|
>
|
>







188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
    transport_log(out);
    free(zOutFile);
  }

  /*
  ** Send the request to the server.
  */
  if (transport_send(&hdr))
	goto write_err;
  if (transport_send(&payload))
	goto write_err;
  blob_reset(&hdr);
  blob_reset(&payload);
  transport_flip();
  
  /*
  ** Read and interpret the server reply
  */

Changes to src/http_transport.c.

257
258
259
260
261
262
263



264
265
266
267
268

269
270
271
272
273
274
275
276
277
278
279
280
281

282
283
284
285

286
287
288
289
290
291
292

293
294


295
296
297
298
299
300
301
    }
    transport.isOpen = 0;
  }
}

/*
** Send content over the wire.



*/
void transport_send(Blob *toSend){
  char *z = blob_buffer(toSend);
  int n = blob_size(toSend);
  transport.nSent += n;

  if( g.urlIsSsh ){
    int sent;
    sent = fwrite(z, 1, n, sshOut);
    fflush(sshOut);
    /* printf("sent %d of %d bytes\n", sent, n); fflush(stdout); */
  }else if( g.urlIsHttps ){
    #ifdef FOSSIL_ENABLE_SSL
    int sent;
    while( n>0 ){
      sent = ssl_send(0, z, n);
      /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */
      if( sent<=0 ) break;
      n -= sent;

    }    
    #endif
  }else if( g.urlIsFile ){
    fwrite(z, 1, n, transport.pFile);

  }else{
    int sent;
    while( n>0 ){
      sent = socket_send(0, z, n);
      /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */
      if( sent<=0 ) break;
      n -= sent;

    }
  }


}

/*
** This routine is called when the outbound message is complete and
** it is time to being recieving a reply.
*/
void transport_flip(void){







>
>
>

|


<
>

<
|

|








>



|
>







>


>
>







257
258
259
260
261
262
263
264
265
266
267
268
269
270

271
272

273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
    }
    transport.isOpen = 0;
  }
}

/*
** Send content over the wire.
** Returns whether sending was errant, i.e.,
** the count of bytes written onto the wire does
** not equal the size of the blob being sent.
*/
int transport_send(Blob *toSend){
  char *z = blob_buffer(toSend);
  int n = blob_size(toSend);

  size_t written = 0;
  if( g.urlIsSsh ){

    written = fwrite(z, 1, n, sshOut);
    fflush(sshOut);
    /* printf("sent %d of %d bytes\n", (unsigned long) written, n); fflush(stdout); */
  }else if( g.urlIsHttps ){
    #ifdef FOSSIL_ENABLE_SSL
    int sent;
    while( n>0 ){
      sent = ssl_send(0, z, n);
      /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */
      if( sent<=0 ) break;
      n -= sent;
      written += sent;
    }    
    #endif
  }else if( g.urlIsFile ){
    written = fwrite(z, 1, n, transport.pFile);
    /* printf("written %d of %d bytes\n", (unsigned long) written, n); fflush(stdout); */
  }else{
    int sent;
    while( n>0 ){
      sent = socket_send(0, z, n);
      /* printf("Sent %d of %d bytes\n", sent, n); fflush(stdout); */
      if( sent<=0 ) break;
      n -= sent;
      written += sent;
    }
  }
  transport.nSent += written;
  return (blob_size(toSend) != written);
}

/*
** This routine is called when the outbound message is complete and
** it is time to being recieving a reply.
*/
void transport_flip(void){

Changes to src/xfer.c.

1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729

    /* Stop the cycle if the server sends a "clone_seqno 0" card and
    ** we have gone at least two rounds.  Always go at least two rounds
    ** on a clone in order to be sure to retrieve the configuration
    ** information which is only sent on the second round.
    */
    if( cloneSeqno<=0 && nCycle>1 ) go = 0;   
  };
  transport_stats(&nSent, &nRcvd, 1);
  fossil_print("Total network traffic: %lld bytes sent, %lld bytes received\n",
               nSent, nRcvd);
  transport_close();
  transport_global_shutdown();
  db_multi_exec("DROP TABLE onremote");
  manifest_crosslink_end();
  content_enable_dephantomize(1);
  db_end_transaction(0);
  return nErr;
}







|











1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729

    /* Stop the cycle if the server sends a "clone_seqno 0" card and
    ** we have gone at least two rounds.  Always go at least two rounds
    ** on a clone in order to be sure to retrieve the configuration
    ** information which is only sent on the second round.
    */
    if( cloneSeqno<=0 && nCycle>1 ) go = 0;   
  }
  transport_stats(&nSent, &nRcvd, 1);
  fossil_print("Total network traffic: %lld bytes sent, %lld bytes received\n",
               nSent, nRcvd);
  transport_close();
  transport_global_shutdown();
  db_multi_exec("DROP TABLE onremote");
  manifest_crosslink_end();
  content_enable_dephantomize(1);
  db_end_transaction(0);
  return nErr;
}