Skip to content

Commit a97f3ce

Browse files
Use the refactored version of Selectables (#470)
* Remove deprecated parameter from select() * Convert Selectables to new interface
1 parent 046628b commit a97f3ce

File tree

14 files changed

+30
-59
lines changed

14 files changed

+30
-59
lines changed

cfgmgr/buffermgrd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ int main(int argc, char **argv)
9696
while (true)
9797
{
9898
Selectable *sel;
99-
int fd, ret;
99+
int ret;
100100

101-
ret = s.select(&sel, &fd, SELECT_TIMEOUT);
101+
ret = s.select(&sel, SELECT_TIMEOUT);
102102
if (ret == Select::ERROR)
103103
{
104104
SWSS_LOG_NOTICE("Error: %s!", strerror(errno));

cfgmgr/intfmgrd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ int main(int argc, char **argv)
6565
while (true)
6666
{
6767
Selectable *sel;
68-
int fd, ret;
68+
int ret;
6969

70-
ret = s.select(&sel, &fd, SELECT_TIMEOUT);
70+
ret = s.select(&sel, SELECT_TIMEOUT);
7171
if (ret == Select::ERROR)
7272
{
7373
SWSS_LOG_NOTICE("Error: %s!", strerror(errno));

cfgmgr/vlanmgrd.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ int main(int argc, char **argv)
8484
while (true)
8585
{
8686
Selectable *sel;
87-
int fd, ret;
87+
int ret;
8888

89-
ret = s.select(&sel, &fd, SELECT_TIMEOUT);
89+
ret = s.select(&sel, SELECT_TIMEOUT);
9090
if (ret == Select::ERROR)
9191
{
9292
SWSS_LOG_NOTICE("Error: %s!", strerror(errno));

fpmsyncd/fpmlink.cpp

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,12 @@ void FpmLink::accept()
8181
SWSS_LOG_INFO("New connection accepted from: %s\n", inet_ntoa(client_addr.sin_addr));
8282
}
8383

84-
void FpmLink::addFd(fd_set *fd)
84+
int FpmLink::getFd()
8585
{
86-
FD_SET(m_connection_socket, fd);
86+
return m_connection_socket;
8787
}
8888

89-
bool FpmLink::isMe(fd_set *fd)
90-
{
91-
return FD_ISSET(m_connection_socket, fd);
92-
}
93-
94-
int FpmLink::readCache()
95-
{
96-
/* FPM doesn't have any caching */
97-
return NODATA;
98-
}
99-
100-
void FpmLink::readMe()
89+
void FpmLink::readData()
10190
{
10291
fpm_msg_hdr_t *hdr;
10392
size_t msg_len;

fpmsyncd/fpmlink.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ class FpmLink : public Selectable {
2525
/* Wait for connection (blocking) */
2626
void accept();
2727

28-
virtual void addFd(fd_set *fd);
29-
virtual bool isMe(fd_set *fd);
30-
virtual int readCache();
31-
virtual void readMe();
32-
28+
int getFd() override;
29+
void readData() override;
3330
/* readMe throws FpmConnectionClosedException when connection is lost */
3431
class FpmConnectionClosedException : public std::exception
3532
{

fpmsyncd/fpmsyncd.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@ int main(int argc, char **argv)
3333
while (true)
3434
{
3535
Selectable *temps;
36-
int tempfd;
37-
/* Reading FPM messages forever (and calling "readMe" to read them) */
38-
s.select(&temps, &tempfd);
36+
/* Reading FPM messages forever (and calling "readData" to read them) */
37+
s.select(&temps);
3938
pipeline.flush();
4039
SWSS_LOG_DEBUG("Pipeline flushed");
4140
}

intfsyncd/intfsyncd.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@ int main(int argc, char **argv)
3333
while (true)
3434
{
3535
Selectable *temps;
36-
int tempfd;
37-
s.select(&temps, &tempfd);
36+
s.select(&temps);
3837
}
3938
}
4039
catch (const std::exception& e)

neighsyncd/neighsyncd.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,7 @@ int main(int argc, char **argv)
3232
while (true)
3333
{
3434
Selectable *temps;
35-
int tempfd;
36-
s.select(&temps, &tempfd);
35+
s.select(&temps);
3736
}
3837
}
3938
catch (const std::exception& e)

orchagent/orch.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ class Executor : public Selectable
7070
virtual ~Executor() { delete m_selectable; }
7171

7272
// Decorating Selectable
73-
virtual void addFd(fd_set *fd) { return m_selectable->addFd(fd); }
74-
virtual bool isMe(fd_set *fd) { return m_selectable->isMe(fd); }
75-
virtual int readCache() { return m_selectable->readCache(); }
76-
virtual void readMe() { return m_selectable->readMe(); }
73+
int getFd() override { return m_selectable->getFd(); }
74+
void readData() override { m_selectable->readData(); }
75+
bool hasCachedData() override { return m_selectable->hasCachedData(); }
76+
bool initializedWithData() override { return m_selectable->initializedWithData(); }
77+
void updateAfterRead() override { m_selectable->updateAfterRead(); }
7778

7879
// Disable copying
7980
Executor(const Executor&) = delete;

orchagent/orchdaemon.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,9 @@ void OrchDaemon::start()
223223
while (true)
224224
{
225225
Selectable *s;
226-
int fd, ret;
226+
int ret;
227227

228-
ret = m_select->select(&s, &fd, SELECT_TIMEOUT);
228+
ret = m_select->select(&s, SELECT_TIMEOUT);
229229

230230
if (ret == Select::ERROR)
231231
{

0 commit comments

Comments
 (0)