base,cpu,dev: Add a level of indirection for ListenSockets.
This makes room for there to be different implementations for different types of sockets. Change-Id: I8c959e2c3400caec8242e693e11330e072bc2c5f Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/69162 Reviewed-by: Yu-hsin Wang <yuhsingw@google.com> Tested-by: kokoro <noreply+kokoro@google.com> Maintainer: Gabe Black <gabe.black@gmail.com>
This commit is contained in:
@@ -121,7 +121,8 @@ Terminal::DataEvent::process(int revent)
|
||||
*/
|
||||
Terminal::Terminal(const Params &p)
|
||||
: SerialDevice(p), listenEvent(NULL), dataEvent(NULL),
|
||||
number(p.number), data_fd(-1), listener(p.name, p.port),
|
||||
number(p.number), data_fd(-1),
|
||||
listener(listenSocketInetConfig(p.port).build(p.name)),
|
||||
txbuf(16384), rxbuf(16384), outfile(terminalDump(p))
|
||||
#if TRACING_ON == 1
|
||||
, linebuf(16384)
|
||||
@@ -175,19 +176,19 @@ Terminal::listen()
|
||||
return;
|
||||
}
|
||||
|
||||
listener.listen();
|
||||
listener->listen();
|
||||
|
||||
listenEvent = new ListenEvent(this, listener.getfd(), POLLIN);
|
||||
listenEvent = new ListenEvent(this, listener->getfd(), POLLIN);
|
||||
pollQueue.schedule(listenEvent);
|
||||
}
|
||||
|
||||
void
|
||||
Terminal::accept()
|
||||
{
|
||||
if (!listener.islistening())
|
||||
if (!listener->islistening())
|
||||
panic("%s: cannot accept a connection if not listening!", name());
|
||||
|
||||
int fd = listener.accept();
|
||||
int fd = listener->accept();
|
||||
if (data_fd != -1) {
|
||||
char message[] = "terminal already attached!\n";
|
||||
atomic_write(fd, message, sizeof(message));
|
||||
|
||||
@@ -101,7 +101,7 @@ class Terminal : public SerialDevice
|
||||
OutputStream * terminalDump(const TerminalParams &p);
|
||||
|
||||
protected:
|
||||
ListenSocket listener;
|
||||
ListenSocketPtr listener;
|
||||
|
||||
void listen();
|
||||
void accept();
|
||||
|
||||
Reference in New Issue
Block a user