aboutsummaryrefslogtreecommitdiff
path: root/src/or/directory.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-10-04 02:38:18 +0000
committerRoger Dingledine <arma@torproject.org>2003-10-04 02:38:18 +0000
commitf563bbd2f988cd1f6ca292f89a47a86f98fe0e8d (patch)
tree08b3ea32a4ce45bc729225bd1beeed555fd0dd52 /src/or/directory.c
parenta6bab569abd3ac8f16a3603813fa03e4585a3bd3 (diff)
downloadtor-f563bbd2f988cd1f6ca292f89a47a86f98fe0e8d.tar
tor-f563bbd2f988cd1f6ca292f89a47a86f98fe0e8d.tar.gz
refactor so connection_write_to_buf() never fails
svn:r537
Diffstat (limited to 'src/or/directory.c')
-rw-r--r--src/or/directory.c22
1 files changed, 5 insertions, 17 deletions
diff --git a/src/or/directory.c b/src/or/directory.c
index 4cbae07b2..88854a35c 100644
--- a/src/or/directory.c
+++ b/src/or/directory.c
@@ -90,10 +90,7 @@ static int directory_send_command(connection_t *conn, int command) {
switch(command) {
case DIR_CONN_STATE_CONNECTING_FETCH:
- if(connection_write_to_buf(fetchstring, strlen(fetchstring), conn) < 0) {
- log_fn(LOG_WARNING,"Couldn't write fetch to buffer.");
- return -1;
- }
+ connection_write_to_buf(fetchstring, strlen(fetchstring), conn);
conn->state = DIR_CONN_STATE_CLIENT_SENDING_FETCH;
break;
case DIR_CONN_STATE_CONNECTING_UPLOAD:
@@ -104,10 +101,7 @@ static int directory_send_command(connection_t *conn, int command) {
}
snprintf(tmp, sizeof(tmp), "POST / HTTP/1.0\r\nContent-Length: %d\r\n\r\n%s",
strlen(s), s);
- if(connection_write_to_buf(tmp, strlen(tmp), conn) < 0) {
- log_fn(LOG_WARNING,"Couldn't write post/descriptor to buffer.");
- return -1;
- }
+ connection_write_to_buf(tmp, strlen(tmp), conn);
conn->state = DIR_CONN_STATE_CLIENT_SENDING_UPLOAD;
break;
}
@@ -200,11 +194,8 @@ static int directory_handle_command(connection_t *conn) {
}
log_fn(LOG_DEBUG,"Dumping directory to client.");
- if((connection_write_to_buf(answerstring, strlen(answerstring), conn) < 0) ||
- (connection_write_to_buf(cp, dlen, conn) < 0)) {
- log_fn(LOG_WARNING,"Failed to write answerstring+directory to outbuf.");
- return -1;
- }
+ connection_write_to_buf(answerstring, strlen(answerstring), conn);
+ connection_write_to_buf(cp, dlen, conn);
conn->state = DIR_CONN_STATE_SERVER_WRITING;
return 0;
}
@@ -218,10 +209,7 @@ static int directory_handle_command(connection_t *conn) {
return -1; /* XXX should write an http failed code */
}
dirserv_get_directory(&cp); /* rebuild and write to disk */
- if(connection_write_to_buf(answerstring, strlen(answerstring), conn) < 0) {
- log_fn(LOG_WARNING,"Failed to write answerstring to outbuf.");
- return -1;
- }
+ connection_write_to_buf(answerstring, strlen(answerstring), conn);
conn->state = DIR_CONN_STATE_SERVER_WRITING;
return 0;
}