Changeset 14347
- Timestamp:
- Nov 30, 2014, 7:38:47 PM (8 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/crypto.c
r14282 r14347 176 176 memset (crypto->mySecret, 0, offset); 177 177 memcpy (crypto->mySecret + offset, secret, len); 178 crypto->mySecretIsSet = 1;178 crypto->mySecretIsSet = true; 179 179 } 180 180 … … 271 271 const uint8_t * hash) 272 272 { 273 crypto->torrentHashIsSet = hash ? 1 : 0;273 crypto->torrentHashIsSet = hash != NULL; 274 274 275 275 if (hash) … … 287 287 } 288 288 289 int 289 bool 290 290 tr_cryptoHasTorrentHash (const tr_crypto * crypto) 291 291 { 292 292 assert (crypto); 293 293 294 return crypto->torrentHashIsSet ? 1 : 0;294 return crypto->torrentHashIsSet; 295 295 } 296 296 -
trunk/libtransmission/crypto.h
r14241 r14347 58 58 const uint8_t* tr_cryptoGetTorrentHash (const tr_crypto * crypto); 59 59 60 inttr_cryptoHasTorrentHash (const tr_crypto * crypto);60 bool tr_cryptoHasTorrentHash (const tr_crypto * crypto); 61 61 62 62 const uint8_t* tr_cryptoComputeSecret (tr_crypto * crypto, -
trunk/libtransmission/fdlimit.c
r14331 r14347 42 42 { 43 43 const char zero = '\0'; 44 bool success = 0;44 bool success = false; 45 45 46 46 if (!length) … … 66 66 preallocate_file_full (const char * filename, uint64_t length) 67 67 { 68 bool success = 0;68 bool success = false; 69 69 70 70 tr_sys_file_t fd = tr_sys_file_open (filename, TR_SYS_FILE_WRITE | TR_SYS_FILE_CREATE, 0666, NULL); -
trunk/libtransmission/handshake.c
r14241 r14347 475 475 evbuffer_add (outbuf, msg, sizeof (msg)); 476 476 477 handshake->haveSentBitTorrentHandshake = 1;477 handshake->haveSentBitTorrentHandshake = true; 478 478 } 479 479 … … 688 688 return tr_handshakeDone (handshake, false); 689 689 tr_peerIoWriteBytes (handshake->io, msg, sizeof (msg), false); 690 handshake->haveSentBitTorrentHandshake = 1;690 handshake->haveSentBitTorrentHandshake = true; 691 691 } 692 692 … … 940 940 941 941 evbuffer_add (outbuf, msg, sizeof (msg)); 942 handshake->haveSentBitTorrentHandshake = 1;942 handshake->haveSentBitTorrentHandshake = true; 943 943 } 944 944 … … 1140 1140 uint8_t msg[HANDSHAKE_SIZE]; 1141 1141 buildHandshakeMessage (handshake, msg); 1142 handshake->haveSentBitTorrentHandshake = 1;1142 handshake->haveSentBitTorrentHandshake = true; 1143 1143 setReadState (handshake, AWAITING_HANDSHAKE); 1144 1144 tr_peerIoWriteBytes (handshake->io, msg, sizeof (msg), false); … … 1157 1157 dbgmsg (handshake, "handshake failed, trying plaintext..."); 1158 1158 buildHandshakeMessage (handshake, msg); 1159 handshake->haveSentBitTorrentHandshake = 1;1159 handshake->haveSentBitTorrentHandshake = true; 1160 1160 setReadState (handshake, AWAITING_HANDSHAKE); 1161 1161 tr_peerIoWriteBytes (handshake->io, msg, sizeof (msg), false); … … 1215 1215 buildHandshakeMessage (handshake, msg); 1216 1216 1217 handshake->haveSentBitTorrentHandshake = 1;1217 handshake->haveSentBitTorrentHandshake = true; 1218 1218 setReadState (handshake, AWAITING_HANDSHAKE); 1219 1219 tr_peerIoWriteBytes (handshake->io, msg, sizeof (msg), false); -
trunk/libtransmission/net.c
r14316 r14347 575 575 static unsigned char ipv6[16]; 576 576 static time_t last_time = 0; 577 static int have_ipv6 = 0;577 static bool have_ipv6 = false; 578 578 const time_t now = tr_time (); 579 579 -
trunk/libtransmission/peer-io.c
r14316 r14347 180 180 canReadWrapper (tr_peerIo * io) 181 181 { 182 bool err = 0;183 bool done = 0;182 bool err = false; 183 bool done = false; 184 184 tr_session * session; 185 185 … … 222 222 if (evbuffer_get_length (io->inbuf)) 223 223 continue; 224 done = 1;224 done = true; 225 225 break; 226 226 227 227 case READ_LATER: 228 done = 1;228 done = true; 229 229 break; 230 230 231 231 case READ_ERR: 232 err = 1;232 err = true; 233 233 break; 234 234 } … … 972 972 } 973 973 974 int 974 bool 975 975 tr_peerIoHasTorrentHash (const tr_peerIo * io) 976 976 { -
trunk/libtransmission/peer-io.h
r14241 r14347 218 218 const uint8_t* tr_peerIoGetTorrentHash (tr_peerIo * io); 219 219 220 inttr_peerIoHasTorrentHash (const tr_peerIo * io);220 bool tr_peerIoHasTorrentHash (const tr_peerIo * io); 221 221 222 222 void tr_peerIoSetTorrentHash (tr_peerIo * io, -
trunk/libtransmission/peer-mgr.c
r14311 r14347 1557 1557 struct peer_atom * atom = peer->atom; 1558 1558 atom->flags2 |= MYFLAG_BANNED; 1559 peer->doPurge = 1;1559 peer->doPurge = true; 1560 1560 tordbg (s, "banning peer %s", tr_atomAddrStr (atom)); 1561 1561 } … … 1812 1812 { 1813 1813 /* some protocol error from the peer */ 1814 peer->doPurge = 1;1814 peer->doPurge = true; 1815 1815 tordbg (s, "setting %s doPurge flag because we got an ERANGE, EMSGSIZE, or ENOTCONN error", 1816 1816 tr_atomAddrStr (peer->atom)); -
trunk/libtransmission/peer-msgs.c
r14334 r14347 679 679 /* build the fast set */ 680 680 msgs->fastsetSize = tr_generateAllowedSet (msgs->fastset, numwant, inf->pieceCount, inf->hash, addr); 681 msgs->haveFastSet = 1;681 msgs->haveFastSet = true; 682 682 683 683 /* send it to the peer */ … … 933 933 934 934 dbgmsg (msgs, "sending an ltep handshake"); 935 msgs->clientSentLtepHandshake = 1;935 msgs->clientSentLtepHandshake = true; 936 936 937 937 /* decide if we want to advertise metadata xfer support (BEP 9) */ 938 938 if (tr_torrentIsPrivate (msgs->torrent)) 939 allow_metadata_xfer = 0;939 allow_metadata_xfer = false; 940 940 else 941 allow_metadata_xfer = 1;941 allow_metadata_xfer = true; 942 942 943 943 /* decide if we want to advertise pex support */ 944 944 if (!tr_torrentAllowsPex (msgs->torrent)) 945 allow_pex = 0;945 allow_pex = false; 946 946 else if (msgs->peerSentLtepHandshake) 947 allow_pex = msgs->peerSupportsPex ? 1 : 0;947 allow_pex = msgs->peerSupportsPex; 948 948 else 949 allow_pex = 1;949 allow_pex = true; 950 950 951 951 tr_variantInitDict (&val, 8); … … 996 996 997 997 tr_peerIoReadBytes (msgs->io, inbuf, tmp, len); 998 msgs->peerSentLtepHandshake = 1;998 msgs->peerSentLtepHandshake = true; 999 999 1000 1000 if (tr_variantFromBenc (&val, tmp, len) || !tr_variantIsDict (&val)) … … 1016 1016 1017 1017 /* check supported messages for utorrent pex */ 1018 msgs->peerSupportsPex = 0;1019 msgs->peerSupportsMetadataXfer = 0;1018 msgs->peerSupportsPex = false; 1019 msgs->peerSupportsMetadataXfer = false; 1020 1020 1021 1021 if (tr_variantDictFindDict (&val, TR_KEY_m, &sub)) { … … 1245 1245 { 1246 1246 dbgmsg (msgs, "got ut pex"); 1247 msgs->peerSupportsPex = 1;1247 msgs->peerSupportsPex = true; 1248 1248 parseUtPex (msgs, msglen, inbuf); 1249 1249 } … … 1251 1251 { 1252 1252 dbgmsg (msgs, "got ut metadata"); 1253 msgs->peerSupportsMetadataXfer = 1;1253 msgs->peerSupportsMetadataXfer = true; 1254 1254 parseUtMetadata (msgs, msglen, inbuf); 1255 1255 } -
trunk/libtransmission/torrent.c
r14344 r14347 1977 1977 1978 1978 assert (tr_isTorrent (tor)); 1979 tor->isDeleting = 1;1979 tor->isDeleting = true; 1980 1980 1981 1981 data = tr_new0 (struct remove_data, 1); -
trunk/libtransmission/upnp.c
r14262 r14347 225 225 "Local Address is \"%s\""), handle->lanaddr); 226 226 handle->state = TR_UPNP_IDLE; 227 handle->hasDiscovered = 1;227 handle->hasDiscovered = true; 228 228 } 229 229 else -
trunk/libtransmission/verify.c
r14327 r14347 44 44 tr_sys_file_t fd = TR_BAD_SYS_FILE; 45 45 uint64_t filePos = 0; 46 bool changed = 0;47 bool hadPiece = 0;46 bool changed = false; 47 bool hadPiece = false; 48 48 time_t lastSleptAt = 0; 49 49 uint32_t piecePos = 0;
Note: See TracChangeset
for help on using the changeset viewer.