NetworkWidget: Add Blocking column
This commit is contained in:
parent
74b2410d7e
commit
4bf7c3e051
|
@ -652,6 +652,12 @@ s32 WiiSockMan::AddSocket(s32 fd, bool is_rw)
|
|||
return wii_fd;
|
||||
}
|
||||
|
||||
bool WiiSockMan::IsSocketBlocking(s32 wii_fd) const
|
||||
{
|
||||
const auto it = WiiSockets.find(wii_fd);
|
||||
return it != WiiSockets.end() && !it->second.nonBlock;
|
||||
}
|
||||
|
||||
s32 WiiSockMan::NewSocket(s32 af, s32 type, s32 protocol)
|
||||
{
|
||||
if (af != 2 && af != 23) // AF_INET && AF_INET6
|
||||
|
|
|
@ -226,6 +226,7 @@ public:
|
|||
// NON-BLOCKING FUNCTIONS
|
||||
s32 NewSocket(s32 af, s32 type, s32 protocol);
|
||||
s32 AddSocket(s32 fd, bool is_rw);
|
||||
bool IsSocketBlocking(s32 wii_fd) const;
|
||||
s32 GetHostSocket(s32 wii_fd) const;
|
||||
s32 DeleteSocket(s32 s);
|
||||
s32 GetLastNetError() const { return errno_last; }
|
||||
|
|
|
@ -90,6 +90,15 @@ QTableWidgetItem* GetSocketState(s32 host_fd)
|
|||
return new QTableWidgetItem(QTableWidget::tr("Unbound"));
|
||||
}
|
||||
|
||||
QTableWidgetItem* GetSocketBlocking(s32 wii_fd)
|
||||
{
|
||||
const auto& socket_manager = IOS::HLE::WiiSockMan::GetInstance();
|
||||
if (socket_manager.GetHostSocket(wii_fd) < 0)
|
||||
return new QTableWidgetItem();
|
||||
const bool is_blocking = socket_manager.IsSocketBlocking(wii_fd);
|
||||
return new QTableWidgetItem(is_blocking ? QTableWidget::tr("Yes") : QTableWidget::tr("No"));
|
||||
}
|
||||
|
||||
static QString GetAddressAndPort(const sockaddr_in& addr)
|
||||
{
|
||||
char buffer[16];
|
||||
|
@ -214,7 +223,8 @@ void NetworkWidget::Update()
|
|||
m_socket_table->setItem(wii_fd, 1, GetSocketDomain(host_fd));
|
||||
m_socket_table->setItem(wii_fd, 2, GetSocketType(host_fd));
|
||||
m_socket_table->setItem(wii_fd, 3, GetSocketState(host_fd));
|
||||
m_socket_table->setItem(wii_fd, 4, GetSocketName(host_fd));
|
||||
m_socket_table->setItem(wii_fd, 4, GetSocketBlocking(wii_fd));
|
||||
m_socket_table->setItem(wii_fd, 5, GetSocketName(host_fd));
|
||||
}
|
||||
m_socket_table->resizeColumnsToContents();
|
||||
|
||||
|
@ -253,7 +263,7 @@ QGroupBox* NetworkWidget::CreateSocketTableGroup()
|
|||
|
||||
m_socket_table = new QTableWidget();
|
||||
// i18n: FD stands for file descriptor (and in this case refers to sockets, not regular files)
|
||||
QStringList header{tr("FD"), tr("Domain"), tr("Type"), tr("State"), tr("Name")};
|
||||
QStringList header{tr("FD"), tr("Domain"), tr("Type"), tr("State"), tr("Blocking"), tr("Name")};
|
||||
m_socket_table->setColumnCount(header.size());
|
||||
|
||||
m_socket_table->setHorizontalHeaderLabels(header);
|
||||
|
|
Loading…
Reference in New Issue