forked from premiere/premiere-libtorrent
*** empty log message ***
This commit is contained in:
parent
98c1c824df
commit
653a4a970d
|
@ -52,6 +52,37 @@ retrying.</p>
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>optional part</p>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
<col width="18%" />
|
||||
<col width="28%" />
|
||||
<col width="54%" />
|
||||
</colgroup>
|
||||
<thead valign="bottom">
|
||||
<tr><th>size</th>
|
||||
<th>name</th>
|
||||
<th>description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody valign="top">
|
||||
<tr><td>int8_t</td>
|
||||
<td>flags</td>
|
||||
<td>1 = authentication</td>
|
||||
</tr>
|
||||
<tr><td>int8_t[8]</td>
|
||||
<td>username</td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<tr><td>int8_t[8]</td>
|
||||
<td>password_hash</td>
|
||||
<td>sha1-hash of the tracker password</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>what is the point of having a fixed size username field instead of
|
||||
a null-terminated string?</p>
|
||||
<p>Why send the hash of the password instead of the password itself?</p>
|
||||
<p>Server replies with packet:</p>
|
||||
<table border class="table">
|
||||
<colgroup>
|
||||
|
|
|
@ -40,6 +40,24 @@ Client sends packet:
|
|||
| int32_t | transaction_id | Randomized by client. |
|
||||
+-------------+---------------------+----------------------------------------+
|
||||
|
||||
optional part
|
||||
|
||||
+-------------+---------------------+----------------------------------------+
|
||||
| size | name | description |
|
||||
+=============+=====================+========================================+
|
||||
| int8_t | flags | 1 = authentication |
|
||||
+-------------+---------------------+----------------------------------------+
|
||||
| int8_t[8] | username | |
|
||||
+-------------+---------------------+----------------------------------------+
|
||||
| int8_t[8] | password_hash | sha1-hash of the tracker password |
|
||||
+-------------+---------------------+----------------------------------------+
|
||||
|
||||
what is the point of having a fixed size username field instead of
|
||||
a null-terminated string?
|
||||
|
||||
Why send the hash of the password instead of the password itself?
|
||||
|
||||
|
||||
Server replies with packet:
|
||||
|
||||
+-------------+---------------------+----------------------------------------+
|
||||
|
|
16
src/file.cpp
16
src/file.cpp
|
@ -38,12 +38,17 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <io.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
typedef int mode_t;
|
||||
|
||||
#else
|
||||
|
||||
#define _FILE_OFFSET_BITS 64
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -57,9 +62,9 @@ namespace
|
|||
{
|
||||
enum { mode_in = 1, mode_out = 2 };
|
||||
|
||||
int map_open_mode(int m)
|
||||
mode_t map_open_mode(int m)
|
||||
{
|
||||
if (m == (mode_in | mode_out)) return O_RDWR | O_BINARY;
|
||||
// if (m == (mode_in | mode_out)) return O_RDWR | O_BINARY;
|
||||
if (m == mode_out) return O_WRONLY | O_CREAT | O_BINARY;
|
||||
if (m == mode_in) return O_RDONLY | O_BINARY;
|
||||
assert(false);
|
||||
|
@ -97,8 +102,10 @@ namespace libtorrent
|
|||
void open(fs::path const& path, int mode)
|
||||
{
|
||||
close();
|
||||
m_fd = ::open(path.native_file_string().c_str(), map_open_mode(mode));
|
||||
m_open_mode = mode;
|
||||
m_fd = ::open(
|
||||
path.native_file_string().c_str()
|
||||
, map_open_mode(mode)
|
||||
, S_IREAD | S_IWRITE);
|
||||
if (m_fd == -1)
|
||||
{
|
||||
std::stringstream msg;
|
||||
|
@ -106,6 +113,7 @@ namespace libtorrent
|
|||
<< strerror(errno);
|
||||
throw file_error(msg.str());
|
||||
}
|
||||
m_open_mode = mode;
|
||||
}
|
||||
|
||||
void close()
|
||||
|
|
Loading…
Reference in New Issue