From 55cbb943ce6dda39996a00ea67361e64be6cce7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20L=C3=B8vborg?= Date: Sat, 7 Jun 2014 21:34:27 +0200 Subject: [PATCH 1/4] Socket: Remove dead member fields. --- elements/userlevel/socket.cc | 1 - elements/userlevel/socket.hh | 2 -- 2 files changed, 3 deletions(-) diff --git a/elements/userlevel/socket.cc b/elements/userlevel/socket.cc index 38dbc1564c..bf47af9c55 100644 --- a/elements/userlevel/socket.cc +++ b/elements/userlevel/socket.cc @@ -356,7 +356,6 @@ Socket::selected(int fd, int) fcntl(_active, F_SETFD, FD_CLOEXEC); add_select(_active, SELECT_READ | SELECT_WRITE); - _events = SELECT_READ | SELECT_WRITE; } // read data from socket diff --git a/elements/userlevel/socket.hh b/elements/userlevel/socket.hh index a254cd1eaa..f1837f748e 100644 --- a/elements/userlevel/socket.hh +++ b/elements/userlevel/socket.hh @@ -213,9 +213,7 @@ private: NotifierSignal _signal; // packet is available to pull() WritablePacket *_rq; // queue to receive pulled packets - int _backoff; // backoff timer for when sendto() blocks Packet *_wq; // queue to store pulled packet for when sendto() blocks - int _events; // keeps track of the events for which select() is waiting int _family; // AF_INET or AF_UNIX int _socktype; // SOCK_STREAM or SOCK_DGRAM From be3dbd1a4590f6678e1268aeb0283c903b332f0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20L=C3=B8vborg?= Date: Tue, 10 Jun 2014 15:56:37 +0200 Subject: [PATCH 2/4] Socket: Remove unused timer. --- elements/userlevel/socket.cc | 3 +-- elements/userlevel/socket.hh | 2 -- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/elements/userlevel/socket.cc b/elements/userlevel/socket.cc index bf47af9c55..7a254d9f96 100644 --- a/elements/userlevel/socket.cc +++ b/elements/userlevel/socket.cc @@ -40,7 +40,7 @@ CLICK_DECLS Socket::Socket() - : _task(this), _timer(this), + : _task(this), _fd(-1), _active(-1), _rq(0), _wq(0), _local_port(0), _local_pathname(""), _timestamp(true), _sndbuf(-1), _rcvbuf(-1), @@ -259,7 +259,6 @@ Socket::initialize(ErrorHandler *errh) ScheduleInfo::join_scheduler(this, &_task, errh); _signal = Notifier::upstream_empty_signal(this, 0, &_task); add_select(_fd, SELECT_WRITE); - _timer.initialize(this); } return 0; diff --git a/elements/userlevel/socket.hh b/elements/userlevel/socket.hh index f1837f748e..7fdd5d68aa 100644 --- a/elements/userlevel/socket.hh +++ b/elements/userlevel/socket.hh @@ -4,7 +4,6 @@ #include #include #include -#include #include #include "../ip/iproutetable.hh" #include @@ -196,7 +195,6 @@ class Socket : public Element { public: protected: Task _task; - Timer _timer; private: int _fd; // socket descriptor From 0bfbdfd36b6c2de69d03f6467a1c6ffdc1e7a8ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20L=C3=B8vborg?= Date: Tue, 10 Jun 2014 17:44:38 +0200 Subject: [PATCH 3/4] Socket: Don't set unused SO_TIMESTAMP socket option. Remove request for kernel timestamps, since 1) Socket uses assign_now (gettimeofday) anyway (instead of using the kernel timestamp), and 2) kernel timestamps are only available for datagram sockets (on Linux, at least); see e.g. this thread: "[PATCH] tcp: SO_TIMESTAMP implementation for TCP" http://comments.gmane.org/gmane.linux.network/159574 --- elements/userlevel/socket.cc | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/elements/userlevel/socket.cc b/elements/userlevel/socket.cc index 7a254d9f96..58a4251a3d 100644 --- a/elements/userlevel/socket.cc +++ b/elements/userlevel/socket.cc @@ -172,17 +172,6 @@ Socket::initialize(ErrorHandler *errh) memcpy(_local.un.sun_path, _local_pathname.c_str(), _local_pathname.length()); } - // enable timestamps - if (_timestamp) { -#ifdef SO_TIMESTAMP - int one = 1; - if (setsockopt(_fd, SOL_SOCKET, SO_TIMESTAMP, &one, sizeof(one)) < 0) - return initialize_socket_error(errh, "setsockopt(SO_TIMESTAMP)"); -#else - return initialize_socket_error(errh, "TIMESTAMP not supported on this platform"); -#endif - } - #ifdef TCP_NODELAY // disable Nagle algorithm if (_protocol == IPPROTO_TCP && _nodelay) From a03a38c5f6bfead4a4f98278c271265398bd112b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20L=C3=B8vborg?= Date: Tue, 10 Jun 2014 15:08:59 +0200 Subject: [PATCH 4/4] Clipboard: Bugfix (possible push of NULL packet). --- elements/standard/clipboard.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/elements/standard/clipboard.cc b/elements/standard/clipboard.cc index 58c29236c4..bfe0836cde 100644 --- a/elements/standard/clipboard.cc +++ b/elements/standard/clipboard.cc @@ -67,7 +67,10 @@ void Clipboard::push(int port, Packet *p) { if (port == 0) copy(p); - else p = paste(p); + else { + p = paste(p); + if (!p) return; + } output(port).push(p); }