Skip to content

Commit

Permalink
Merge pull request kohler#131 from kwi-dk/bugfixes
Browse files Browse the repository at this point in the history
Socket and Clipboard bugfixes
  • Loading branch information
kohler committed Jun 17, 2014
2 parents 7272847 + a03a38c commit c197357
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 19 deletions.
5 changes: 4 additions & 1 deletion elements/standard/clipboard.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
15 changes: 1 addition & 14 deletions elements/userlevel/socket.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -259,7 +248,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;
Expand Down Expand Up @@ -356,7 +344,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
Expand Down
4 changes: 0 additions & 4 deletions elements/userlevel/socket.hh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <click/element.hh>
#include <click/string.hh>
#include <click/task.hh>
#include <click/timer.hh>
#include <click/notifier.hh>
#include "../ip/iproutetable.hh"
#include <sys/un.h>
Expand Down Expand Up @@ -196,7 +195,6 @@ class Socket : public Element { public:

protected:
Task _task;
Timer _timer;

private:
int _fd; // socket descriptor
Expand All @@ -213,9 +211,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
Expand Down

0 comments on commit c197357

Please sign in to comment.