As the data for SET_ROW can fail because of multiple sends we do a couple of retries to get the correct data
This commit is contained in:
parent
c139273f15
commit
6af1954d50
@ -217,8 +217,6 @@ static void deleteArea(int rowPos, int track, int bufferWidth, int bufferHeight)
|
|||||||
const int track_count = getTrackCount();
|
const int track_count = getTrackCount();
|
||||||
struct sync_track** tracks = getTracks();
|
struct sync_track** tracks = getTracks();
|
||||||
|
|
||||||
rlog(R_INFO, "rowPos %d track %d bw %d bh %d\n", bufferWidth, bufferHeight);
|
|
||||||
|
|
||||||
for (i = 0; i < bufferWidth; ++i)
|
for (i = 0; i < bufferWidth; ++i)
|
||||||
{
|
{
|
||||||
size_t trackPos = track + i;
|
size_t trackPos = track + i;
|
||||||
@ -591,10 +589,31 @@ static int processCommands()
|
|||||||
|
|
||||||
case SET_ROW:
|
case SET_ROW:
|
||||||
{
|
{
|
||||||
RemoteConnection_recv((char*)&newRow, sizeof(int), 0);
|
int i = 0;
|
||||||
s_editorData.trackViewInfo.rowPos = htonl(newRow);
|
ret = RemoteConnection_recv((char*)&newRow, sizeof(int), 0);
|
||||||
rlog(R_INFO, "row from demo %d\n", s_editorData.trackViewInfo.rowPos);
|
|
||||||
|
if (ret == -1)
|
||||||
|
{
|
||||||
|
// retry to get the data and do it for max of 20 times otherwise disconnect
|
||||||
|
|
||||||
|
for (i = 0; i < 20; ++i)
|
||||||
|
{
|
||||||
|
if (RemoteConnection_recv((char*)&newRow, sizeof(int), 0) == 4)
|
||||||
|
{
|
||||||
|
s_editorData.trackViewInfo.rowPos = htonl(newRow);
|
||||||
|
rlog(R_INFO, "row from demo %d\n", s_editorData.trackViewInfo.rowPos);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
s_editorData.trackViewInfo.rowPos = htonl(newRow);
|
||||||
|
rlog(R_INFO, "row from demo %d\n", s_editorData.trackViewInfo.rowPos);
|
||||||
|
}
|
||||||
|
|
||||||
ret = 1;
|
ret = 1;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -252,7 +252,7 @@ void RemoteConnection_disconnect()
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
bool RemoteConnection_recv(char* buffer, size_t length, int flags)
|
int RemoteConnection_recv(char* buffer, size_t length, int flags)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -267,7 +267,7 @@ bool RemoteConnection_recv(char* buffer, size_t length, int flags)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@ -18,7 +18,7 @@ void RemoteConnection_close();
|
|||||||
bool RemoteConnection_isPaused();
|
bool RemoteConnection_isPaused();
|
||||||
bool RemoteConnection_connected();
|
bool RemoteConnection_connected();
|
||||||
void RemoteConnection_disconnect();
|
void RemoteConnection_disconnect();
|
||||||
bool RemoteConnection_recv(char* buffer, size_t length, int flags);
|
int RemoteConnection_recv(char* buffer, size_t length, int flags);
|
||||||
bool RemoteConnection_send(const char* buffer, size_t length, int flags);
|
bool RemoteConnection_send(const char* buffer, size_t length, int flags);
|
||||||
bool RemoteConnection_pollRead();
|
bool RemoteConnection_pollRead();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user