Skip to content

Commit

Permalink
Various Windows-related fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
mikedld committed Jan 1, 2017
1 parent a7349fb commit fda9f4b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions utp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,7 +859,7 @@ void UTPSocket::send_data(PacketFormat* b, size_t length, bandwidth_type_t type)
int flags = version == 0 ? b->flags : b1->type();
uint16 seq_nr = version == 0 ? b->seq_nr : b1->seq_nr;
uint16 ack_nr = version == 0 ? b->ack_nr : b1->ack_nr;
LOG_UTPV("0x%08x: send %s len:%u id:%u timestamp:"I64u" reply_micro:%u flags:%s seq_nr:%u ack_nr:%u",
LOG_UTPV("0x%08x: send %s len:%u id:%u timestamp:" I64u " reply_micro:%u flags:%s seq_nr:%u ack_nr:%u",
this, addrfmt(addr, addrbuf), (uint)length, conn_id_send, time, reply_micro, flagnames[flags],
seq_nr, ack_nr);
#endif
Expand Down Expand Up @@ -1705,7 +1705,7 @@ void UTPSocket::apply_ledbat_ccontrol(size_t bytes_acked, uint32 actual_delay, i
// used in parse_log.py
LOG_UTP("0x%08x: actual_delay:%u our_delay:%d their_delay:%u off_target:%d max_window:%u "
"delay_base:%u delay_sum:%d target_delay:%d acked_bytes:%u cur_window:%u "
"scaled_gain:%f rtt:%u rate:%u quota:%d wnduser:%u rto:%u timeout:%d get_microseconds:"I64u" "
"scaled_gain:%f rtt:%u rate:%u quota:%d wnduser:%u rto:%u timeout:%d get_microseconds:" I64u " "
"cur_window_packets:%u packet_size:%u their_delay_base:%u their_actual_delay:%u",
this, actual_delay, our_delay / 1000, their_hist.get_value() / 1000,
(int)off_target / 1000, (uint)(max_window), our_hist.delay_base,
Expand Down Expand Up @@ -1790,7 +1790,7 @@ size_t UTP_ProcessIncoming(UTPSocket *conn, const byte *packet, size_t len, bool

if (pk_flags >= ST_NUM_STATES) return 0;

LOG_UTPV("0x%08x: Got %s. seq_nr:%u ack_nr:%u state:%s version:%u timestamp:"I64u" reply_micro:%u",
LOG_UTPV("0x%08x: Got %s. seq_nr:%u ack_nr:%u state:%s version:%u timestamp:" I64u " reply_micro:%u",
conn, flagnames[pk_flags], pk_seq_nr, pk_ack_nr, statenames[conn->state], conn->version,
conn->version == 0?(uint64)(pf->tv_sec) * 1000000 + pf->tv_usec:uint64(pf1->tv_usec),
conn->version == 0?(uint32)(pf->reply_micro):(uint32)(pf1->reply_micro));
Expand Down
8 changes: 7 additions & 1 deletion utp.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,18 @@
#include "utypes.h"

#ifdef WIN32
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN
#endif
#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#ifdef _MSC_VER
#pragma comment(lib,"ws2_32.lib")
#endif
#else
#include <stdlib.h>
#include <sys/types.h>
Expand Down Expand Up @@ -142,7 +148,7 @@ struct UTPStats {
};

// Get stats for UTP socket
void UTP_GetStats(struct UTPSocket *socket, UTPStats *stats);
void UTP_GetStats(struct UTPSocket *socket, struct UTPStats *stats);
#endif

// Close the UTP socket.
Expand Down

0 comments on commit fda9f4b

Please sign in to comment.