Removed on_ping_recv_callback. Removed last_ping_time from spdylay_session.

This commit is contained in:
Tatsuhiro Tsujikawa 2012-01-31 21:29:46 +09:00
parent e0526aac9a
commit 1139502675
4 changed files with 0 additions and 28 deletions

View File

@ -51,8 +51,6 @@ AC_CHECK_LIB([cunit], [CU_initialize_registry],
[have_cunit=yes], [have_cunit=no]) [have_cunit=yes], [have_cunit=no])
AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ]) AM_CONDITIONAL([HAVE_CUNIT], [ test "x${have_cunit}" = "xyes" ])
AC_SEARCH_LIBS([clock_gettime], [rt])
# Checks for header files. # Checks for header files.
AC_CHECK_HEADERS([ \ AC_CHECK_HEADERS([ \
arpa/inet.h \ arpa/inet.h \

View File

@ -207,12 +207,6 @@ typedef void (*spdylay_on_invalid_ctrl_recv_callback)
(spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame, (spdylay_session *session, spdylay_frame_type type, spdylay_frame *frame,
void *user_data); void *user_data);
/*
* Callback function invoked when PING reply is received from peer.
*/
typedef void (*spdylay_on_ping_recv_callback)
(spdylay_session *session, const struct timespec *rtt, void *user_data);
/* /*
* Callback function invoked when data chunk of DATA frame is * Callback function invoked when data chunk of DATA frame is
* received. |stream_id| is the stream ID of this DATA frame belongs * received. |stream_id| is the stream ID of this DATA frame belongs
@ -271,7 +265,6 @@ typedef struct {
spdylay_recv_callback recv_callback; spdylay_recv_callback recv_callback;
spdylay_on_ctrl_recv_callback on_ctrl_recv_callback; spdylay_on_ctrl_recv_callback on_ctrl_recv_callback;
spdylay_on_invalid_ctrl_recv_callback on_invalid_ctrl_recv_callback; spdylay_on_invalid_ctrl_recv_callback on_invalid_ctrl_recv_callback;
spdylay_on_ping_recv_callback on_ping_recv_callback;
spdylay_on_data_chunk_recv_callback on_data_chunk_recv_callback; spdylay_on_data_chunk_recv_callback on_data_chunk_recv_callback;
spdylay_on_data_recv_callback on_data_recv_callback; spdylay_on_data_recv_callback on_data_recv_callback;
spdylay_before_ctrl_send_callback before_ctrl_send_callback; spdylay_before_ctrl_send_callback before_ctrl_send_callback;

View File

@ -78,7 +78,6 @@ int spdylay_session_client_new(spdylay_session **session_ptr,
(*session_ptr)->next_unique_id = 1; (*session_ptr)->next_unique_id = 1;
(*session_ptr)->last_ping_unique_id = 0; (*session_ptr)->last_ping_unique_id = 0;
memset(&(*session_ptr)->last_ping_time, 0, sizeof(struct timespec));
(*session_ptr)->goaway_flags = SPDYLAY_GOAWAY_NONE; (*session_ptr)->goaway_flags = SPDYLAY_GOAWAY_NONE;
(*session_ptr)->last_good_stream_id = 0; (*session_ptr)->last_good_stream_id = 0;
@ -537,8 +536,6 @@ static int spdylay_session_after_frame_sent(spdylay_session *session)
/* We record the time now and show application code RTT when /* We record the time now and show application code RTT when
reply PING is received. */ reply PING is received. */
session->last_ping_unique_id = frame->ping.unique_id; session->last_ping_unique_id = frame->ping.unique_id;
/* TODO If clock_gettime() fails, what should we do? */
clock_gettime(CLOCK_MONOTONIC_RAW, &session->last_ping_time);
break; break;
case SPDYLAY_GOAWAY: case SPDYLAY_GOAWAY:
session->goaway_flags |= SPDYLAY_GOAWAY_SEND; session->goaway_flags |= SPDYLAY_GOAWAY_SEND;
@ -868,21 +865,9 @@ int spdylay_session_on_ping_received(spdylay_session *session,
if(frame->ping.unique_id != 0) { if(frame->ping.unique_id != 0) {
if(session->last_ping_unique_id == frame->ping.unique_id) { if(session->last_ping_unique_id == frame->ping.unique_id) {
/* This is ping reply from peer */ /* This is ping reply from peer */
struct timespec rtt;
clock_gettime(CLOCK_MONOTONIC_RAW, &rtt);
rtt.tv_nsec -= session->last_ping_time.tv_nsec;
if(rtt.tv_nsec < 0) {
rtt.tv_nsec += 1000000000;
--rtt.tv_sec;
}
rtt.tv_sec -= session->last_ping_time.tv_sec;
/* Assign 0 to last_ping_unique_id so that we can ignore same /* Assign 0 to last_ping_unique_id so that we can ignore same
ID. */ ID. */
session->last_ping_unique_id = 0; session->last_ping_unique_id = 0;
if(session->callbacks.on_ping_recv_callback) {
session->callbacks.on_ping_recv_callback(session, &rtt,
session->user_data);
}
spdylay_session_call_on_ctrl_frame_received(session, SPDYLAY_PING, frame); spdylay_session_call_on_ctrl_frame_received(session, SPDYLAY_PING, frame);
} else if((session->server && frame->ping.unique_id % 2 == 1) || } else if((session->server && frame->ping.unique_id % 2 == 1) ||
(!session->server && frame->ping.unique_id % 2 == 0)) { (!session->server && frame->ping.unique_id % 2 == 0)) {

View File

@ -29,8 +29,6 @@
# include <config.h> # include <config.h>
#endif /* HAVE_CONFIG_H */ #endif /* HAVE_CONFIG_H */
#include <time.h>
#include <spdylay/spdylay.h> #include <spdylay/spdylay.h>
#include "spdylay_pq.h" #include "spdylay_pq.h"
#include "spdylay_map.h" #include "spdylay_map.h"
@ -109,8 +107,6 @@ typedef struct spdylay_session {
/* The last unique ID sent to the peer. */ /* The last unique ID sent to the peer. */
uint32_t last_ping_unique_id; uint32_t last_ping_unique_id;
/* Time stamp when last ping is sent. */
struct timespec last_ping_time;
/* Flags indicating GOAWAY is sent and/or recieved. The flags are /* Flags indicating GOAWAY is sent and/or recieved. The flags are
composed by bitwise OR-ing spdylay_goaway_flag. */ composed by bitwise OR-ing spdylay_goaway_flag. */