File Conn_engine_core.c changed (mode: 100644) (index c6b82f9..77ef865) |
... |
... |
void Conn_speed(char *dst, const unsigned int dst_len, const unsigned int speed) |
399 |
399 |
snprintf(dst, dst_len, "%.2fMBps", sp / 1000 / 1000); |
snprintf(dst, dst_len, "%.2fMBps", sp / 1000 / 1000); |
400 |
400 |
} |
} |
401 |
401 |
|
|
402 |
|
char *Conn_status_slot(const struct Conn *C) |
|
|
402 |
|
char *Conn_status_slot(struct Conn *C) |
403 |
403 |
{ |
{ |
404 |
404 |
static char tmp[1024]; |
static char tmp[1024]; |
405 |
405 |
char polle[16], pollr[16]; |
char polle[16], pollr[16]; |
406 |
406 |
char speedi[32], speedo[32]; |
char speedi[32], speedo[32]; |
407 |
407 |
unsigned int dT, si, so; |
unsigned int dT, si, so; |
408 |
408 |
char flags[128], flags_add[2]; |
char flags[128], flags_add[2]; |
|
409 |
|
char *local_addr, *remote_addr; |
|
410 |
|
int local_port, remote_port; |
409 |
411 |
char flags_tmp[64]; |
char flags_tmp[64]; |
410 |
412 |
|
|
411 |
413 |
/* flags */ |
/* flags */ |
|
... |
... |
char *Conn_status_slot(const struct Conn *C) |
438 |
440 |
Conn_speed(speedi, sizeof(speedi), si); |
Conn_speed(speedi, sizeof(speedi), si); |
439 |
441 |
Conn_speed(speedo, sizeof(speedo), so); |
Conn_speed(speedo, sizeof(speedo), so); |
440 |
442 |
|
|
|
443 |
|
local_addr = "-"; |
|
444 |
|
local_port = 0; |
|
445 |
|
remote_addr = "-"; |
|
446 |
|
remote_port = 0; |
|
447 |
|
if (C->type == CONN_TYPE_MASTER) { |
|
448 |
|
local_addr = C->bind_addr; |
|
449 |
|
local_port = C->bind_port; |
|
450 |
|
} else if (C->type == CONN_TYPE_P2P) { |
|
451 |
|
local_addr = C->bind_addr; |
|
452 |
|
local_port = C->bind_port; |
|
453 |
|
remote_addr = C->addr; |
|
454 |
|
remote_port = C->port; |
|
455 |
|
} |
|
456 |
|
|
441 |
457 |
snprintf(tmp, sizeof(tmp), "id=%llu slot=%d fd=%d" |
snprintf(tmp, sizeof(tmp), "id=%llu slot=%d fd=%d" |
442 |
458 |
" %s/%s/%s" |
" %s/%s/%s" |
443 |
459 |
" %s %s" |
" %s %s" |
444 |
460 |
" %s/%d <-> %s/%d" |
" %s/%d <-> %s/%d" |
445 |
|
"via=%llu [%s][%s] IO=%llu/%llu" |
|
|
461 |
|
" via=%llu [%s][%s] IO=%llu/%llu" |
446 |
462 |
" BS=%u/%u S=%s/%s" |
" BS=%u/%u S=%s/%s" |
447 |
463 |
" T=%ld bw=%u f=%u tk=%u [%s]\n", |
" T=%ld bw=%u f=%u tk=%u [%s]\n", |
448 |
464 |
C->id, C->slot, C->fd, |
C->id, C->slot, C->fd, |
449 |
465 |
Conn_domain(C), Conn_type(C), Conn_protocol(C), |
Conn_domain(C), Conn_type(C), Conn_protocol(C), |
450 |
466 |
Conn_socktype(C), Conn_state(C), |
Conn_socktype(C), Conn_state(C), |
451 |
|
C->bind_addr, C->bind_port, C->addr, C->port, |
|
|
467 |
|
local_addr, local_port, remote_addr, remote_port, |
452 |
468 |
C->via, polle, pollr, C->bi, C->bo, |
C->via, polle, pollr, C->bi, C->bo, |
453 |
469 |
C->ibuf_size, C->obuf_size, speedi, speedo, |
C->ibuf_size, C->obuf_size, speedi, speedo, |
454 |
470 |
Conn_now.tv_sec - C->start, |
Conn_now.tv_sec - C->start, |
File Conn_engine_core.h changed (mode: 100644) (index a4a673c..4d3b95e) |
... |
... |
extern struct Conn_queue Conn_queue_free; |
260 |
260 |
extern char *Conn_strerror(void); |
extern char *Conn_strerror(void); |
261 |
261 |
extern void Log(const unsigned short level, char *format, ...); |
extern void Log(const unsigned short level, char *format, ...); |
262 |
262 |
extern char *Conn_errno(const struct Conn *C); |
extern char *Conn_errno(const struct Conn *C); |
263 |
|
extern char *Conn_status_slot(const struct Conn *C); |
|
|
263 |
|
extern char *Conn_status_slot(struct Conn *C); |
264 |
264 |
extern char *Conn_status(const unsigned int flags); |
extern char *Conn_status(const unsigned int flags); |
265 |
265 |
extern int Conn_try_expand_buf(struct Conn *C, const int what, |
extern int Conn_try_expand_buf(struct Conn *C, const int what, |
266 |
266 |
const int needed); |
const int needed); |